-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement protocol 2.0; change db schema #101
base: master
Are you sure you want to change the base?
Commits on Oct 20, 2021
-
Configuration menu - View commit details
-
Copy full SHA for dc7eb24 - Browse repository at this point
Copy the full SHA dc7eb24View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1877119 - Browse repository at this point
Copy the full SHA 1877119View commit details -
Configuration menu - View commit details
-
Copy full SHA for 81d8dd1 - Browse repository at this point
Copy the full SHA 81d8dd1View commit details -
history db: sort key insertion order
Supposedly it makes a difference (see e.g. [0]), and depending on how batching works it makes sense it would, but during a few full syncs of testnet I've done, it was within measurement error. Still, existing code was already doing this. [0]: https://stackoverflow.com/q/54941342
Configuration menu - View commit details
-
Copy full SHA for 92cb55c - Browse repository at this point
Copy the full SHA 92cb55cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9c22323 - Browse repository at this point
Copy the full SHA 9c22323View commit details -
with the pending db changes, an upgrade is ~as fast as a resync from genesis
Configuration menu - View commit details
-
Copy full SHA for 6d38d0f - Browse repository at this point
Copy the full SHA 6d38d0fView commit details -
session: blockchain.transaction.get_merkle: make "height" optional
now that we have our own txindex
Configuration menu - View commit details
-
Copy full SHA for 1853023 - Browse repository at this point
Copy the full SHA 1853023View commit details -
Configuration menu - View commit details
-
Copy full SHA for 90561ef - Browse repository at this point
Copy the full SHA 90561efView commit details -
history db: store a (prev_txnum, prev_idx)->spender_txnum map
This will allow looking up which tx spent an outpoint.
Configuration menu - View commit details
-
Copy full SHA for 4ebda7a - Browse repository at this point
Copy the full SHA 4ebda7aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 64189cc - Browse repository at this point
Copy the full SHA 64189ccView commit details -
Configuration menu - View commit details
-
Copy full SHA for 95c6ce6 - Browse repository at this point
Copy the full SHA 95c6ce6View commit details -
db: change TXOUTIDX_LEN from 4 to 3, to save db storage size
In Bitcoin consensus, a txout index is stored as a uint32_t. However, in practice, an output in a tx uses at least 10 bytes (for an OP_TRUE output), so - to exhaust a 2 byte namespace, a tx would need to have a size of at least 2 ** 16 * 10 = 655 KB, - to exhaust a 3 byte namespace, a tx would need to have a size of at least 2 ** 24 * 10 = 167 MB.
Configuration menu - View commit details
-
Copy full SHA for 4326ae7 - Browse repository at this point
Copy the full SHA 4326ae7View commit details -
session: implement "blockchain.outpoint.subscribe" RPC
notifications not implemented yet
Configuration menu - View commit details
-
Copy full SHA for 3a41279 - Browse repository at this point
Copy the full SHA 3a41279View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7c7612b - Browse repository at this point
Copy the full SHA 7c7612bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 65a7dd3 - Browse repository at this point
Copy the full SHA 65a7dd3View commit details -
"blockchain.outpoint.subscribe" RPC: distinguish heights "-1" and "0"
Similar to scripthash statuses, the height of an unconfirmed tx is: - `-1` if it has any unconfirmed parents, - `0` otherwise.
Configuration menu - View commit details
-
Copy full SHA for b87a8ea - Browse repository at this point
Copy the full SHA b87a8eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 79e2690 - Browse repository at this point
Copy the full SHA 79e2690View commit details -
session: wait for protocol ver negotiation to finish before other reqs
We already enforce that server.version must be the first received message in a session, but we also need to ensure that the server finishes processing that message and sets up the correct protocol version before starting to process further messages.
Configuration menu - View commit details
-
Copy full SHA for 8b7efde - Browse repository at this point
Copy the full SHA 8b7efdeView commit details -
(bugfix) db: change tx_num endianness (LE->BE) to match db comparator
History.get_txnums and History.backup depend on ordering of tx_nums, so we want the lexicographical order (used by leveldb comparator) to match the numerical order.
Configuration menu - View commit details
-
Copy full SHA for f410565 - Browse repository at this point
Copy the full SHA f410565View commit details -
protocol change: define order of mempool txs in status of scripthash
Note that this is a soft fork: the server can apply it even for past protocol versions. Previously, with the order being undefined, if an address had multiple mempool transactions touching it, switching between different servers could result in a change in address status simply as a result of these servers ordering mempool txs differently. This would result in the client re-requesting the whole history of the address. ----- D/i | interface.[electrum.blockstream.info:60002] | <-- ('blockchain.scripthash.subscribe', ['660b44502503064f9d5feee48726287c0973e25bc531b4b8a072f57f143d5cd0']) {} (id: 12) D/i | interface.[electrum.blockstream.info:60002] | --> 9da27f9df91e3f860212f65b736fa20a539ba6e3d509f6370367ee7f10a4d5b0 (id: 12) D/i | interface.[electrum.blockstream.info:60002] | <-- ('blockchain.scripthash.get_history', ['660b44502503064f9d5feee48726287c0973e25bc531b4b8a072f57f143d5cd0']) {} (id: 13) D/i | interface.[electrum.blockstream.info:60002] | --> [ {'fee': 200, 'height': 0, 'tx_hash': '3ee6d6e26291ce360127fe039b816470fce6eeea19b5c9d10829a1e4efc2d0c7'}, {'fee': 239, 'height': 0, 'tx_hash': '9e050f09b676b9b0ee26aa02ccee623fae585a85d6a5e24ecedd6f8d6d2d3b1d'}, {'fee': 178, 'height': 0, 'tx_hash': 'fb80adbf8274190418cb3fb0385d82fe9d47a844d9913684fa5fb3d48094b35a'}, {'fee': 200, 'height': 0, 'tx_hash': '713933c50b7c43f606dad5749ea46e3bc6622657e9b13ace9d639697da266e8b'} ] (id: 13) D/i | interface.[testnet.hsmiths.com:53012] | <-- ('blockchain.scripthash.subscribe', ['660b44502503064f9d5feee48726287c0973e25bc531b4b8a072f57f143d5cd0']) {} (id: 12) D/i | interface.[testnet.hsmiths.com:53012] | --> f7ef7237d2d62a3280acae05616200b96ad9dd85fd0473c29152a4a41e05686c (id: 12) D/i | interface.[testnet.hsmiths.com:53012] | <-- ('blockchain.scripthash.get_history', ['660b44502503064f9d5feee48726287c0973e25bc531b4b8a072f57f143d5cd0']) {} (id: 13) D/i | interface.[testnet.hsmiths.com:53012] | --> [ {'tx_hash': '9e050f09b676b9b0ee26aa02ccee623fae585a85d6a5e24ecedd6f8d6d2d3b1d', 'height': 0, 'fee': 239}, {'tx_hash': 'fb80adbf8274190418cb3fb0385d82fe9d47a844d9913684fa5fb3d48094b35a', 'height': 0, 'fee': 178}, {'tx_hash': '3ee6d6e26291ce360127fe039b816470fce6eeea19b5c9d10829a1e4efc2d0c7', 'height': 0, 'fee': 200}, {'tx_hash': '713933c50b7c43f606dad5749ea46e3bc6622657e9b13ace9d639697da266e8b', 'height': 0, 'fee': 200} ] (id: 13)
Configuration menu - View commit details
-
Copy full SHA for df12667 - Browse repository at this point
Copy the full SHA df12667View commit details -
DB storage: implement iterator.seek(key)
in a way that works consistently between LevelDB and RocksDB.
Configuration menu - View commit details
-
Copy full SHA for 0494caf - Browse repository at this point
Copy the full SHA 0494cafView commit details -
Configuration menu - View commit details
-
Copy full SHA for 312e61d - Browse repository at this point
Copy the full SHA 312e61dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 660deec - Browse repository at this point
Copy the full SHA 660deecView commit details -
"scripthash.get_history": impl updates for proto 1.5; no client_* yet
Handling of client_statushash and client_height is not yet implemented.
Configuration menu - View commit details
-
Copy full SHA for 36202d3 - Browse repository at this point
Copy the full SHA 36202d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3dcb9f1 - Browse repository at this point
Copy the full SHA 3dcb9f1View commit details -
session: rework statushash calculation.
If a client requested the status of a very busy address (with cold cache: no precalc yet), we might have gotten a timeout before we stored any intermediate status calculated. Then, if the client reconnected and requested the same, we would get stuck in this loop and never make progress. With this change, we try to store intermediate hashes sooner, so that even if there is a timeout, if the client reconnects there is less work to be done.
Configuration menu - View commit details
-
Copy full SHA for 09a15fb - Browse repository at this point
Copy the full SHA 09a15fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for cee2d3f - Browse repository at this point
Copy the full SHA cee2d3fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2bfbc5c - Browse repository at this point
Copy the full SHA 2bfbc5cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 31f8427 - Browse repository at this point
Copy the full SHA 31f8427View commit details -
Configuration menu - View commit details
-
Copy full SHA for 264daec - Browse repository at this point
Copy the full SHA 264daecView commit details -
Configuration menu - View commit details
-
Copy full SHA for ef830fd - Browse repository at this point
Copy the full SHA ef830fdView commit details