Transaction

6d19d2826cf5dba9a35dcde5229c80074294560c80d082fa36d7c00a09150b1d
Timestamp (utc)
2024-03-24 16:17:04
Fee Paid
0.00000026 BSV
(
0.01046716 BSV
-
0.01046690 BSV
)
Fee Rate
10.22 sat/KB
Version
1
Confirmations
97,417
Size Stats
2,543 B

2 Outputs

Total Output:
0.01046690 BSV
  • j"1LAnZuoQdcKCkpDBKQMCgziGMoPC4VQUckMó<div class="post">I instrumented my import using the <a href="http://bitcointalk.org/index.php?topic=1999.0">-initblock=FILE patch</a> posted last night, putting printf tracepoints in TxnBegin, TxnCommit, TxnAbort, Read and Write:<br/><br/><div class="codeheader">Code:</div><div class="code">ProcessBlock: ACCEPTED<br/>CDB::Write()<br/>DB4: txn_begin<br/>CDB::Write()<br/>CDB::Write()<br/>CDB::Write()<br/>DB4: txn_commit<br/>SetBestChain: new best=000000005b5c1859db19 &nbsp;height=1751 &nbsp;work=7524897523416<br/>ProcessBlock: ACCEPTED<br/>CDB::Write()<br/>DB4: txn_begin<br/>CDB::Write()<br/>CDB::Write()<br/>CDB::Write()<br/>DB4: txn_commit<br/>SetBestChain: new best=00000000f396ab6b62ba &nbsp;height=1752 &nbsp;work=7529192556249<br/>ProcessBlock: ACCEPTED<br/>CDB::Write()<br/>DB4: txn_begin<br/>CDB::Write()<br/>CDB::Write()<br/>CDB::Write()<br/>DB4: txn_commit<br/>SetBestChain: new best=000000000c6bcf972117 &nbsp;height=1753 &nbsp;work=7533487589082<br/></div><br/>So, it appears that we have a CDB::Write() that occurs outside of a transaction (vTxn is empty??).<br/><br/>txnid==NULL is perfectly legal for db4, but it does mean that callpath may be operating outside of the DB_TXN_NOSYNC flag that is set in ::TxnBegin(). &nbsp;Thus, a CDB::Write() outside of a transaction <i>may</i> have synchronous behavior (DB_TXN_SYNC) as governed by DB_AUTO_COMMIT database flag.<br/><br/>EDIT: &nbsp;Wrapping WriteBlockIndex() inside a transaction does seem to speed up local disk import (-initblocks).<br/><br/><div class="codeheader">Code:</div><div class="code">--- a/main.cpp<br/>+++ b/main.cpp<br/>@@ -1427,7 +1427,10 @@ bool CBlock::AddToBlockIndex(unsigned int nFile, unsigned<br/>&nbsp; &nbsp; &nbsp;pindexNew-&gt;bnChainWork = (pindexNew-&gt;pprev ? pindexNew-&gt;pprev-&gt;bnChainWork <br/>&nbsp;<br/>&nbsp; &nbsp; &nbsp;CTxDB txdb;<br/>+&nbsp; &nbsp; txdb.TxnBegin();<br/>&nbsp; &nbsp; &nbsp;txdb.WriteBlockIndex(CDiskBlockIndex(pindexNew));<br/>+&nbsp; &nbsp; if (!txdb.TxnCommit())<br/>+&nbsp; &nbsp; &nbsp; &nbsp;return false;<br/>&nbsp;<br/><br/></div><br/>Of course that implies begin+commit+begin+commit in quick succession (SetBestChain), so maybe a less naive approach might be preferred (nested transactions, or wrap both db4 writes in the same transaction).</div> text/html
    https://whatsonchain.com/tx/6d19d2826cf5dba9a35dcde5229c80074294560c80d082fa36d7c00a09150b1d