UTXO snapshot creation (dumptxoutset) #16899

pull jamesob wants to merge 5 commits into bitcoin:master from jamesob:2019-09-au-dumptxoutset changing 9 files +270 −10
  1. jamesob commented at 5:12 pm on September 17, 2019: member

    This is part of the assumeutxo project:

    Parent PR: #15606 Issue: #15605 Specification: https://github.com/jamesob/assumeutxo-docs/tree/master/proposal


    This changeset defines the serialization format for UTXO snapshots and adds an RPC command for creating them, dumptxoutset. It also adds a convenience script for generating and verifying snapshots at a certain height, since that requires doing a hacky rewind of the chain via invalidateblock.

    All of this is unused at the moment.

  2. jamesob force-pushed on Sep 17, 2019
  3. in src/node/coinstats.h:30 in fd56894a3f outdated
    23@@ -24,7 +24,10 @@ struct CCoinsStats
    24     uint64_t nDiskSize;
    25     CAmount nTotalAmount;
    26 
    27-    CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nBogoSize(0), nDiskSize(0), nTotalAmount(0) {}
    28+    // The number of coins contained.
    29+    uint64_t coins_count;
    30+
    31+    CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nBogoSize(0), nDiskSize(0), nTotalAmount(0), coins_count(0) {}
    


    MarcoFalke commented at 5:24 pm on September 17, 2019:

    I’d prefer to use C++11 member initialization

    0uint64_t coins_count{0};
    

    Feel free to keep the others (or switch them over as well)


    jamesob commented at 2:49 pm on September 18, 2019:
    Changed them all.
  4. in src/rpc/blockchain.cpp:2277 in fd56894a3f outdated
    2272+            "  \"coins_written\": n,   (numeric) the number of coins written in the snapshot\n"
    2273+            "  \"base_hash\": \"...\",   (string) the hash of the base of the snapshot\n"
    2274+            "  \"base_height\": n,     (string) the hash of the base of the snapshot\n"
    2275+            "  \"path\": \"...\"         (string) the absolute path that the snapshot was written to\n"
    2276+            "]\n"},
    2277+            }.ToString()
    


    MarcoFalke commented at 5:25 pm on September 17, 2019:
    This should use the new .Check() syntax on RPCHelpMan?

    jamesob commented at 2:48 pm on September 18, 2019:
    Fixed, thanks.
  5. in src/rpc/blockchain.cpp:2272 in fd56894a3f outdated
    2270+                RPCResults{},
    2271+                RPCExamples{"{\n"
    2272+            "  \"coins_written\": n,   (numeric) the number of coins written in the snapshot\n"
    2273+            "  \"base_hash\": \"...\",   (string) the hash of the base of the snapshot\n"
    2274+            "  \"base_height\": n,     (string) the hash of the base of the snapshot\n"
    2275+            "  \"path\": \"...\"         (string) the absolute path that the snapshot was written to\n"
    


    MarcoFalke commented at 5:26 pm on September 17, 2019:
    Looks like this is the Result, not an Example?

    jamesob commented at 2:48 pm on September 18, 2019:
    Ah, right - fixed.
  6. jamesob force-pushed on Sep 17, 2019
  7. in src/validation.h:752 in e30e3a4c07 outdated
    744@@ -744,6 +745,62 @@ bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, C
    745 /** Remove invalidity status from a block and its descendants. */
    746 void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
    747 
    748+/**
    749+ * Serialized version of a UTXO set from which an assumed-valid CChainState
    750+ * can be constructed.
    751+ */
    752+class SnapshotMetadata
    


    jamesob commented at 5:32 pm on September 17, 2019:
    Could also create src/node/utxo_snapshot.{h,cpp} and add this there if that seems preferable.
  8. in src/validation.h:757 in e30e3a4c07 outdated
    752+class SnapshotMetadata
    753+{
    754+public:
    755+    //! The block header of the block that reflects the tip of the chain for the
    756+    //! UTXO set contained in this snapshot.
    757+    CDiskBlockIndex m_base_blockheader;
    


    MarcoFalke commented at 5:34 pm on September 17, 2019:
    Why does this need the header (as opposed to just the hash of the header?)

    jamesob commented at 2:55 pm on September 18, 2019:
    During snapshot activation we use m_base_blockheader.nHeight to index into the expected assumeutxo hash values, but beyond that I don’t think we use other parts of the header. I can split out the height if you like, but I don’t see much harm in taking on a few extra bytes for the complete header in case it’s somehow advantageous to have in the future.

    MarcoFalke commented at 5:56 pm on September 18, 2019:
    How is m_base_blockheader.nHeight different from LookupBlockIndex(m_base_blockhash)->nHeight?

    jamesob commented at 6:02 pm on September 18, 2019:
    Ah yeah, that’s a good point. I’ll revert to using a hash in the snapshot and just do the lookup during activation.

    MarcoFalke commented at 6:27 pm on September 18, 2019:
    thx!
  9. MarcoFalke commented at 5:34 pm on September 17, 2019: member
    .
  10. MarcoFalke commented at 5:41 pm on September 17, 2019: member
    What was the conclusion on the question whether the dump should include all headers?
  11. jamesob force-pushed on Sep 17, 2019
  12. DrahtBot added the label RPC/REST/ZMQ on Sep 17, 2019
  13. DrahtBot added the label Scripts and tools on Sep 17, 2019
  14. DrahtBot added the label Tests on Sep 17, 2019
  15. DrahtBot added the label Validation on Sep 17, 2019
  16. DrahtBot commented at 6:49 pm on September 17, 2019: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #16523 (Add removemempoolentry RPC to evict transactions from the mempool by metalicjames)
    • #16365 (Log RPC parameters (arguments) if -debug=rpcparams by LarryRuane)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  17. fanquake removed the label Tests on Sep 17, 2019
  18. jamesob force-pushed on Sep 18, 2019
  19. jamesob force-pushed on Sep 18, 2019
  20. jamesob force-pushed on Sep 18, 2019
  21. jamesob commented at 6:04 pm on September 18, 2019: member

    What was the conclusion on the question whether the dump should include all headers?

    We need to connect to peers to make the node usable anyway, and headers take very little time to sync, so I don’t see much benefit to bundling the headers with the snapshot. Though if anyone thinks differently I’d be curious to hear why.

  22. jamesob force-pushed on Sep 18, 2019
  23. in src/validation.h:749 in 3511d6b2ea outdated
    744@@ -744,6 +745,62 @@ bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, C
    745 /** Remove invalidity status from a block and its descendants. */
    746 void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
    747 
    748+/**
    749+ * Serialized version of a UTXO set from which an assumed-valid CChainState
    


    ariard commented at 12:25 pm on September 22, 2019:
    Not sure if assume-valid is the best wording, with assume-valid only script checks are skipped but others are kept like double spends or BIP 68. With assume-utxo, none of this checks are done.
  24. in src/validation.h:765 in 3511d6b2ea outdated
    760+    uint256 m_utxo_contents_hash = {};
    761+
    762+    //! The number of coins in the UTXO set contained in this snapshot.
    763+    uint64_t m_coins_count = 0;
    764+
    765+    //! Necessary to "fake" the base nChainTx so that we can estimate progress during
    


    ariard commented at 12:28 pm on September 22, 2019:
    Not clear, you’re talking about the progress of background UTXO set here, which is estimated compare to nChainTx of foreground one ?
  25. in src/validation.h:775 in 3511d6b2ea outdated
    770+    //! to the base block of the snapshot (`m_base_blockhash`).
    771+    //!
    772+    //! This is serialized (vs. being memory only) because once we complete
    773+    //! validation of a snapshot, we update the metadata on disk so that the next
    774+    //! time bitcoind starts up, we know we've validated the snapshot. This would
    775+    //! be unnecessary if we overwrote the `chainstate` leveldb directory with the
    


    ariard commented at 12:43 pm on September 22, 2019:
    Don’t get this field, it is serialized down to a utxo.dat file, which is going to be pass to other nodes, what’s the meaning of validation completed for them ?

    ryanofsky commented at 4:04 pm on September 24, 2019:

    re: #16899 (review)

    In commit “validation: add unused SnapshotMetadata class” (3511d6b2ea65219a18dbb6d6ca45a4de62569dc1)

    Don’t get this field, it is serialized down to a utxo.dat file, which is going to be pass to other nodes, what’s the meaning of validation completed for them ?

    I guess SnapshotMetadata is being used for two different things:

    • As a header for dumptxoutset data
    • As a way to track state if a node is shut down in the middle of background sync.

    I think it would probably be clearer to use separate structs, maybe having the first one included in the second one to avoid duplication.


    jamesob commented at 8:49 pm on September 25, 2019:
    Good points. I’ve removed this field for now. I’ll defer figuring out exactly how to track this state to when I file the PR for loading snapshots, but I suspect I’ll just use the presence of a /datadir/chainstate_* directory to indicate an unvalidated assumeutxo chainstate, then overwrite /datadir/chainstate on validation.
  26. in src/rpc/blockchain.cpp:2273 in b6af8f5443 outdated
    2267+        },
    2268+        RPCResult{
    2269+            "{\n"
    2270+            "  \"coins_written\": n,   (numeric) the number of coins written in the snapshot\n"
    2271+            "  \"base_hash\": \"...\",   (string) the hash of the base of the snapshot\n"
    2272+            "  \"base_height\": n,     (string) the hash of the base of the snapshot\n"
    


    ariard commented at 12:43 pm on September 22, 2019:
    “the height”
  27. in test/functional/rpc_dumptxoutset.py:36 in 52bba3c322 outdated
    31+        assert_equal(out['path'], str(expected_path))
    32+        assert out['base_hash']
    33+
    34+        # TODO I'd like to make assertions about the contents of the file
    35+        # (ideally its hash), but because we can't get a deterministic block
    36+        # header (we'd need to mock time) and we have no way of deserializing
    


    MarcoFalke commented at 3:27 pm on September 24, 2019:

    Why can’t you use mock time here?

    Also, the test isn’t running (see travis)


    jamesob commented at 8:44 pm on September 25, 2019:
    To get a deterministic blockheader, we’d need to use GetTime<...>() here: https://github.com/bitcoin/bitcoin/blob/master/src/miner.cpp#L93

    MarcoFalke commented at 8:50 pm on September 25, 2019:
    Huh, that nTimeStart is only used for logging benchmarks

    jamesob commented at 9:02 pm on September 25, 2019:
    Ah oops, you’re totally right. Will try with mock.
  28. in src/validation.h:762 in 3511d6b2ea outdated
    757+    uint256 m_base_blockhash;
    758+
    759+    //! A hash of the snapshot contents as generated by `GetUTXOStats`.
    760+    uint256 m_utxo_contents_hash = {};
    761+
    762+    //! The number of coins in the UTXO set contained in this snapshot.
    


    ryanofsky commented at 4:06 pm on September 24, 2019:

    In commit “validation: add unused SnapshotMetadata class” (3511d6b2ea65219a18dbb6d6ca45a4de62569dc1)

    Comments for m_utxo_contents_hash m_coins_count fields could say what they are used for.


    jamesob commented at 3:36 pm on September 26, 2019:
    Thanks for this feedback - made me realize that there’s really no point anymore to bundling the contents hash with the snapshot.
  29. in src/rpc/blockchain.cpp:2258 in b6af8f5443 outdated
    2254+ */
    2255+UniValue dumptxoutset(const JSONRPCRequest& request)
    2256+{
    2257+    RPCHelpMan{
    2258+        "dumptxoutset",
    2259+        "\nWrite the serialized UTXO set to disk.\n"
    


    ryanofsky commented at 4:12 pm on September 24, 2019:

    In commit “rpc: add dumptxoutset” (b6af8f5443c9891ade4fa5ca92a244e3ff8cac79)

    Up to you, but I think documentation could say more about

    • Data format
    • What you’d use this function for, or it’s mostly meant to be useful for developers
    • Status of the implementation. If this is experimental, whether the data format might change, if there’s going to be a corresponding load rpc method
  30. in src/rpc/blockchain.cpp:2282 in b6af8f5443 outdated
    2277+            HelpExampleCli("dumptxoutset", "utxo.dat")
    2278+        }
    2279+    }.Check(request);
    2280+
    2281+    fs::path path = request.params[0].get_str();
    2282+    if (path.is_relative()) {
    


    ryanofsky commented at 4:22 pm on September 24, 2019:

    In commit “rpc: add dumptxoutset” (b6af8f5443c9891ade4fa5ca92a244e3ff8cac79)

    Think you could drop this conditional and just say path = fs::absolute(path, GetDataDir());

  31. in src/rpc/blockchain.cpp:2345 in b6af8f5443 outdated
    2337+        }
    2338+
    2339+        pcursor->Next();
    2340+    }
    2341+
    2342+    afile.fclose();
    


    ryanofsky commented at 4:33 pm on September 24, 2019:

    In commit “rpc: add dumptxoutset” (b6af8f5443c9891ade4fa5ca92a244e3ff8cac79)

    Implementation seems fine for now. Unclear if in the future we might want to:

    • Put some magic bytes in snapshot header so to make it easier to recognize a snapshot file
    • Add version or length fields to make it possible to extend the format and include additional data
    • Write to temporary file and then rename in case theres a shutdown or crash in the middle of writing so you can distinguish an incomplete snapshot from a complete one
  32. in src/rpc/blockchain.cpp:2380 in b6af8f5443 outdated
    2376@@ -2275,6 +2377,7 @@ static const CRPCCommand commands[] =
    2377     { "blockchain",         "preciousblock",          &preciousblock,          {"blockhash"} },
    2378     { "blockchain",         "scantxoutset",           &scantxoutset,           {"action", "scanobjects"} },
    2379     { "blockchain",         "getblockfilter",         &getblockfilter,         {"blockhash", "filtertype"} },
    2380+    { "blockchain",         "dumptxoutset",           &dumptxoutset,           {"path"} },
    


    ryanofsky commented at 4:40 pm on September 24, 2019:

    In commit “rpc: add dumptxoutset” (b6af8f5443c9891ade4fa5ca92a244e3ff8cac79)

    Might want to move this to the hidden section, unless it’s useful for something other than debugging. Also, if the format or usage might change, it might be better to not expose so compatibility is less a concern.

  33. ryanofsky approved
  34. ryanofsky commented at 4:54 pm on September 24, 2019: member
    utACK 52bba3c322b338d27a96ec31b37df702aca428c5
  35. jamesob force-pushed on Sep 25, 2019
  36. jamesob force-pushed on Sep 26, 2019
  37. jamesob force-pushed on Sep 26, 2019
  38. Sjors commented at 11:30 am on September 30, 2019: member

    A progress indicator would be nice. If it wasn’t for the system activity monitor showing CPU and disk write activity I would have interrupted the script somewhere during the ~ half an hour dumptxoutset takes.

    Maybe the script should call setnetworkactive false. E.g. I’m seeing Warning: not punishing manually-connected peer, as well as a P2P timeout error.

    Checksum on macOS 10.14.6 for block 597000: 3fd987a705a9b70f3197ebbe782ff457b1ea6ca373ac37b5c1a3764f7c414fe4 (produced twice, but on the same datadir)

    0{
    1  "coins_written": 62228899,
    2  "base_hash": "0000000000000000000eadb01d27f7b6ca1c17e71f0ff33853de9d3b25c57e55",
    3}
    
  39. in src/node/coinstats.cpp:52 in c2830a9828 outdated
    50@@ -51,6 +51,7 @@ bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats)
    51     }
    52     ss << stats.hashBlock;
    53     uint256 prevkey;
    54+    unsigned int coins_count{0};
    


    MarcoFalke commented at 12:09 pm on September 30, 2019:

    I don’t really like that coins_count is initialized to zero at the beginning of the function, but the other members of stats aren’t. I’d prefer if all stats are initialized in one go:

    0stats = CCoinsStats{}; // reset stats
    

    MarcoFalke commented at 10:37 pm on November 4, 2019:
    @jamesob ping

    jamesob commented at 3:19 pm on November 5, 2019:
    Oops, missed this one. Willfix.
  40. ryanofsky approved
  41. ryanofsky commented at 5:09 pm on September 30, 2019: member
    utACK c2830a9828c85acfc94caeae3d3ec641ed3d148a. Changes since last review: new utxo_snapshot.h file, removed hash and validation_complete snapshot metadata fields, fixed dumptxoutset base_height documentation, dumped to temporary file and renamed instead of writing directly, extended rpc_dumptxoutset test removing todo
  42. laanwj referenced this in commit 30c2b0b1cb on Oct 2, 2019
  43. laanwj added the label Feature on Oct 2, 2019
  44. sidhujag referenced this in commit a7b114133b on Oct 2, 2019
  45. laanwj commented at 11:35 am on October 23, 2019: member
    Concept ACK, thanks for working on this, will test.
  46. laanwj commented at 7:49 am on October 24, 2019: member

    this currently fails the new rpc_dumptxoutset.py test, both in CI and locally

     02019-10-24T07:46:53.097000Z TestFramework (INFO): Initializing test directory /tmp/test_runner_₿_🏃_20191024_094030/rpc_dumptxoutset_22
     12019-10-24T07:46:53.489000Z TestFramework (ERROR): Assertion failed
     2Traceback (most recent call last):                      
     3  File "/store/orion/projects/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 194, in main
     4    self.run_test()                                      
     5  File "/home/orion/projects/bitcoin/bitcoin/test/functional/rpc_dumptxoutset.py", line 39, in run_test
     6    '10c25df662424c94d06458aa5ecc7bd73680aa098f5093fdd5fa27fb2af08568')
     7  File "/store/orion/projects/bitcoin/bitcoin/test/functional/test_framework/util.py", line 46, in assert_equal
     8    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
     9AssertionError: not(4fac28ba32694cf370432ca408620e053a370f11de8b19488568ed1308d9b511 == 10c25df662424c94d06458aa5ecc7bd73680aa098f5093fdd5fa27fb2af08568)
    102019-10-24T07:46:53.565000Z TestFramework (INFO): Stopping nodes
    112019-10-24T07:46:53.817000Z TestFramework (WARNING): Not cleaning up dir /tmp/test_runner_₿_🏃_20191024_094030/rpc_dumptxoutset_22
    122019-10-24T07:46:53.818000Z TestFramework (ERROR): Test failed. Test logging available at /tmp/test_runner_₿_🏃_20191024_094030/rpc_dumptxoutset_22/test_framework.log
    132019-10-24T07:46:53.819000Z TestFramework (ERROR): Hint: Call /store/orion/projects/bitcoin/bitcoin/test/functional/combine_logs.py '/tmp/test_runner_₿_🏃_20191024_094030/rpc_dumptxoutset_22' to cons
    14olidate all logs  
    
  47. in test/functional/rpc_dumptxoutset.py:24 in c2830a9828 outdated
    19+        self.num_nodes = 1
    20+
    21+    def run_test(self):
    22+        """Test a trivial usage of the dumptxoutset RPC command."""
    23+        node = self.nodes[0]
    24+        node.setmocktime(int(time.mktime(datetime.datetime(2019, 9, 9, 0, 0).timetuple())))
    


    laanwj commented at 8:32 am on October 24, 2019:
    Pretty sure this varies based on locale (time.mktime uses local timezone). As this is a constant, and the rest of the test depends on this exact value, might was well hardcode a value here.

    MarcoFalke commented at 12:29 pm on October 24, 2019:

    You can maybe use

    0getblockheader(getblockhash(0))[time] + 1
    
  48. jamesob force-pushed on Oct 24, 2019
  49. in test/functional/rpc_dumptxoutset.py:11 in 4e60702a1c outdated
     6+"""
     7+from test_framework.test_framework import BitcoinTestFramework
     8+from test_framework.util import assert_equal, assert_raises_rpc_error
     9+
    10+import hashlib
    11+import time
    


    MarcoFalke commented at 5:45 pm on October 24, 2019:
    unused import?
  50. jamesob force-pushed on Oct 24, 2019
  51. in test/functional/rpc_dumptxoutset.py:40 in 95beaf6333 outdated
    35+        # Blockhash should be deterministic based on mocked time.
    36+        assert_equal(
    37+            out['base_hash'],
    38+            '6fd417acba2a8738b06fee43330c50d58e6a725046c3d843c8dd7e51d46d1ed6')
    39+
    40+        with open(expected_path, 'rb') as f:
    


    MarcoFalke commented at 7:17 pm on October 24, 2019:

    https://travis-ci.org/bitcoin/bitcoin/jobs/602444006#L6364

    0                                       with open(expected_path, 'rb') as f:
    1                                   TypeError: invalid file: PosixPath('/home/travis/build/bitcoin/bitcoin/ci/scratch/test_runner/test_runner_\u20bf_🏃_20191024_181754/rpc_dumptxoutset_22/node0/regtest/txoutset.dat')
    

    MarcoFalke commented at 7:18 pm on October 24, 2019:
    This is python 3.5
  52. laanwj added this to the milestone 0.20.0 on Oct 25, 2019
  53. jamesob force-pushed on Oct 25, 2019
  54. DrahtBot added the label Needs rebase on Oct 28, 2019
  55. add unused SnapshotMetadata class 707fde7b9b
  56. jamesob force-pushed on Oct 29, 2019
  57. DrahtBot removed the label Needs rebase on Oct 29, 2019
  58. in src/rpc/blockchain.cpp:2332 in 95c7f5ef55 outdated
    2327+
    2328+    COutPoint key;
    2329+    Coin coin;
    2330+
    2331+    while (pcursor->Valid()) {
    2332+        boost::this_thread::interruption_point();
    


    laanwj commented at 11:59 am on October 30, 2019:
    There’s no point in adding a boost interruption point here. RPC threads aren’t managed by a boost thread group. Check IsRPCRunning() instead.

    jamesob commented at 7:18 pm on November 4, 2019:
    Ah if that’s the case then we should fix FindScriptPubKey at some point too. https://github.com/bitcoin/bitcoin/blob/master/src/rpc/blockchain.cpp#L1970-L1978

    MarcoFalke commented at 12:14 pm on November 5, 2019:
    I wouldn’t mind fixing it in this pull in a new commit. It seem like you copy-pasted the code from there, so it wouldn’t hurt review if people saw where the code came from
  59. laanwj referenced this in commit a37f4c220a on Oct 30, 2019
  60. ryanofsky approved
  61. ryanofsky commented at 5:11 pm on October 31, 2019: member
    Code review ACK 95c7f5ef5511de5b0637b27c238139e94e541399. Changes since last review: rebase, more stable setmocktime call
  62. jamesob force-pushed on Nov 4, 2019
  63. jamesob commented at 7:29 pm on November 4, 2019: member

    au.dumptxoutset.13 -> au.dumptxoutset.14

    Removed used of boost::interruption_point on @laanwj’s advice.

  64. coinstats: add coins_count
    Also changes existing CCoinsStats attributes to be C++11 initialized.
    92fafb3a7d
  65. jamesob force-pushed on Nov 5, 2019
  66. rpc: add dumptxoutset
    Allows the creation of a UTXO snapshot to disk.
    57cf74c991
  67. devtools: add utxo_snapshot.sh
    to allow easy (if not time-consuming) generation and verification of
    snapshots.
    c1ccbc3dde
  68. test: add dumptxoutset RPC test 92b2f5306b
  69. jamesob force-pushed on Nov 5, 2019
  70. laanwj commented at 6:39 pm on November 5, 2019: member

    We should remove all uses of boost::interruption_point in RPC code, but not in this PR.

    ACK 92b2f5306ba0b3f031293cb8f415b67cb002c2f1

  71. laanwj referenced this in commit b05b28183c on Nov 5, 2019
  72. laanwj merged this on Nov 5, 2019
  73. laanwj closed this on Nov 5, 2019

  74. in contrib/devtools/utxo_snapshot.sh:19 in 92b2f5306b
    14+  echo "  if <snapshot-out-path> is '-', don't produce a snapshot file but instead print the "
    15+  echo "  expected assumeutxo hash"
    16+  echo
    17+  echo 'Examples:'
    18+  echo
    19+  echo "  ./contrib/devtools/utxo_snapshot.sh 570000 utxo.dat ./src/bitcoin-cli -datadir=\$(pwd)/testdata"
    


    Sjors commented at 6:48 pm on November 5, 2019:
    I’m making a snapshot at height 600000, will share a torrent link later.
  75. MarcoFalke commented at 6:49 pm on November 5, 2019: member
    Post merge ACK. Good stuff @jamesob
  76. in contrib/devtools/utxo_snapshot.sh:33 in 92b2f5306b
    28+
    29+# Block we'll invalidate/reconsider to rewind/fast-forward the chain.
    30+PIVOT_BLOCKHASH=$($BITCOIN_CLI_CALL getblockhash $(( GENERATE_AT_HEIGHT + 1 )) )
    31+
    32+(>&2 echo "Rewinding chain back to height ${GENERATE_AT_HEIGHT} (by invalidating ${PIVOT_BLOCKHASH}); this may take a while")
    33+${BITCOIN_CLI_CALL} invalidateblock "${PIVOT_BLOCKHASH}"
    


    Sjors commented at 6:51 pm on November 5, 2019:
    For others trying this: it’s best to call setnetworkactive false first
  77. sidhujag referenced this in commit 9df460f09f on Nov 7, 2019
  78. fanquake added this to the "Done" column in a project

  79. jasonbcox referenced this in commit a2fd700b84 on Oct 16, 2020
  80. sidhujag referenced this in commit f0b0681fa2 on Nov 10, 2020
  81. UdjinM6 referenced this in commit fba2a546f6 on Oct 29, 2021
  82. pravblockc referenced this in commit 37d1b95013 on Nov 18, 2021
  83. MarcoFalke locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me