0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00
bitcoin-core/src
merge-script 38c30a4b50
Merge bitcoin/bitcoin#30515: rpc: add utxo's blockhash and number of confirmations to scantxoutset output
17845e7f21 rpc: add utxo's blockhash and number of confirmations to scantxoutset output (Luis Schwab)

Pull request description:

  This PR resolves #30478 by adding two fields to the `scantxoutset` RPC:
  - blockhash: the blockhash that an UTXO was created
  - confirmations: the number of confirmations an UTXO has relative to the chaintip.

  The rationale for the first field is that a blockhash is a much more reliable identifier than the height:
  > When using the scantxoutset RPC, the current behaviour is to show the block height of the UTXO. This is not optimal, as block height is ambiguous, especially in the case of a block reorganization happening at the same instant of the query. In this case, an UTXO that does not exist would be assumed to exist, unless the chain's tip hash is recorded before the scan, and make sure it still exists after, as per https://github.com/bitcoindevkit/bdk/issues/895#issuecomment-1475766797 comment by evanlinjin.

  The second one was suggested by maflcko, and I agree it's useful for human users:
  > While touching this, another thing to add could be the number of confirmations? I understand that this wouldn't help machine consumers of the interface, but human callers may find it useful?

  This will yield an RPC output like so:

  ```diff
  bitcoin-cli scantxoutset start "[\"addr(bc1q5q9344vdyjkcgv79ve3tldz4jmx4lf7knmnx6r)\"]"
  {
    "success": true,
    "txouts": 185259116,
    "height": 853622,
    "bestblock": "00000000000000000002e97d9be8f0ddf31829cf873061b938c10b0f80f708b2",
    "unspents": [
      {
        "txid": "fae435084345fe26e464994aebc6544875bca0b897bf4ce52a65901ae28ace92",
        "vout": 0,
        "scriptPubKey": "0014a00b1ad58d24ad8433c56662bfb45596cd5fa7d6",
        "desc": "addr(bc1q5q9344vdyjkcgv79ve3tldz4jmx4lf7knmnx6r)#smk4xmt7",
        "amount": 0.00091190,
        "coinbase": false,
        "height": 852741,
  +     "blockhash": "00000000000000000002eefe7e7db44d5619c3dace4c65f3fdcd2913d4945c13",
  +     "confirmations": 882
      }
    ],
    "total_amount": 0.00091190
  }
  ```

ACKs for top commit:
  sipa:
    utACK 17845e7f21
  Eunovo:
    ACK 17845e7f21
  tdb3:
    ACK 17845e7f21

Tree-SHA512: 02366d0004e5d547522115ef0efe6794a35978db53dda12c675cfae38197bf43f0bf89ca99a3d79e3d2cff95186015fe1ab764abb8ab82bda440ae9302ad973b
2024-07-28 13:36:15 +01:00
..
bench bench: add cluster linearization improvement benchmark 2024-07-25 10:16:40 -04:00
common random: get rid of GetRand by inlining 2024-07-01 12:39:53 -04:00
compat
config
consensus
crc32c
crypto refactor: fix missing includes 2024-07-24 15:57:01 +01:00
index tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
init Introduce Mining interface 2024-06-18 18:47:51 +02:00
interfaces refactor: pass BlockCreateOptions to createNewBlock 2024-07-16 10:27:57 +02:00
ipc
kernel Merge bitcoin/bitcoin#30406: refactor: modernize-use-equals-default 2024-07-11 19:08:46 +01:00
leveldb
logging
minisketch
node refactor: Add FlatFileSeq member variables in BlockManager 2024-07-24 09:39:35 +02:00
policy tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
primitives tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
qt scripted-diff: Rename SetHex to SetHexDeprecated 2024-07-24 09:15:34 +02:00
rpc Merge bitcoin/bitcoin#30515: rpc: add utxo's blockhash and number of confirmations to scantxoutset output 2024-07-28 13:36:15 +01:00
script Merge bitcoin/bitcoin#28923: script/sign: avoid duplicated signature verification after signing (+introduce signing benchmarks) 2024-07-16 16:19:07 -04:00
secp256k1 Update secp256k1 subtree to latest master 2024-06-25 15:01:00 +01:00
support cleanse: Use SecureZeroMemory for mingw-w64 (release) builds 2024-07-24 09:57:49 +01:00
test Merge bitcoin/bitcoin#30386: Early logging improvements 2024-07-26 08:06:08 -04:00
univalue test: Fix MSVC warning C4101 "unreferenced local variable" 2024-07-16 22:40:25 +01:00
util refactor: Expose FromHex in transaction_identifier 2024-07-24 17:39:44 +02:00
wallet fuzz: reduce keypool size in scriptpubkeyman target 2024-07-20 12:52:19 -03:00
zmq tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
.bear-tidy-config
.clang-format
.clang-tidy Merge bitcoin/bitcoin#30234: Enable clang-tidy checks for self-assignment 2024-07-11 19:21:05 +01:00
addrdb.cpp random: get rid of GetRand by inlining 2024-07-01 12:39:53 -04:00
addrdb.h
addresstype.cpp
addresstype.h
addrman.cpp random: add RandomMixin::randbits with compile-known bits 2024-07-01 10:26:46 -04:00
addrman.h
addrman_impl.h
arith_uint256.cpp
arith_uint256.h Merge bitcoin/bitcoin#30234: Enable clang-tidy checks for self-assignment 2024-07-11 19:21:05 +01:00
attributes.h
banman.cpp
banman.h
base58.cpp
base58.h
bech32.cpp
bech32.h
bip324.cpp
bip324.h
bitcoin-chainstate.cpp Merge bitcoin/bitcoin#30386: Early logging improvements 2024-07-26 08:06:08 -04:00
bitcoin-cli-res.rc
bitcoin-cli.cpp
bitcoin-tx-res.rc
bitcoin-tx.cpp refactor: Replace ParseHashStr with FromHex 2024-07-24 17:40:18 +02:00
bitcoin-util-res.rc
bitcoin-util.cpp
bitcoin-wallet-res.rc
bitcoin-wallet.cpp
bitcoind-res.rc
bitcoind.cpp
blockencodings.cpp test: Make blockencodings_tests deterministic 2024-06-19 22:56:30 +01:00
blockencodings.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
blockfilter.cpp
blockfilter.h
chain.cpp
chain.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
chainparams.cpp
chainparams.h
chainparamsbase.cpp
chainparamsbase.h
chainparamsseeds.h
checkqueue.h
clientversion.cpp
clientversion.h
cluster_linearize.h clusterlin: permit passing in existing linearization to Linearize 2024-07-25 10:16:40 -04:00
coins.cpp
coins.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
compressor.cpp
compressor.h
core_io.h refactor: Replace ParseHashStr with FromHex 2024-07-24 17:40:18 +02:00
core_memusage.h
core_read.cpp refactor: Replace ParseHashStr with FromHex 2024-07-24 17:40:18 +02:00
core_write.cpp
cuckoocache.h validation: Don't error if maxsigcachesize exceeds uint32::max 2024-07-04 22:35:29 +02:00
dbwrapper.cpp
dbwrapper.h
deploymentinfo.cpp
deploymentinfo.h
deploymentstatus.cpp
deploymentstatus.h
dummywallet.cpp
external_signer.cpp
external_signer.h
flatfile.cpp refactor: Add FlatFileSeq member variables in BlockManager 2024-07-24 09:39:35 +02:00
flatfile.h refactor: Add FlatFileSeq member variables in BlockManager 2024-07-24 09:39:35 +02:00
hash.cpp
hash.h
headerssync.cpp random: get rid of GetRand by inlining 2024-07-01 12:39:53 -04:00
headerssync.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
httprpc.cpp Merge bitcoin/bitcoin#28167: init: Add option for rpccookie permissions (replace 26088) 2024-06-27 17:35:08 -04:00
httprpc.h
httpserver.cpp rest: don't copy data when sending binary response 2024-06-26 06:47:30 +03:00
httpserver.h Merge bitcoin/bitcoin#30406: refactor: modernize-use-equals-default 2024-07-11 19:08:46 +01:00
i2p.cpp Merge bitcoin/bitcoin#29833: i2p: fix and improve logs 2024-06-26 15:28:26 -04:00
i2p.h
indirectmap.h
init.cpp Merge bitcoin/bitcoin#22729: Make it possible to disable Tor binds and abort startup on bind failure 2024-07-16 16:27:24 -04:00
init.h refactor: fix missing includes 2024-07-24 15:57:01 +01:00
key.cpp
key.h refactor: add self-assign checks to classes which violate the clang-tidy check 2024-06-14 10:27:03 +00:00
key_io.cpp
key_io.h
logging.cpp logging: use std::string_view 2024-07-19 15:44:38 +10:00
logging.h logging: use std::string_view 2024-07-19 15:44:38 +10:00
Makefile.am clusterlin: introduce cluster_linearize.h with Cluster and DepGraph types 2024-07-25 10:16:37 -04:00
Makefile.bench.include bench: Candidate finding and linearization benchmarks 2024-07-25 10:16:40 -04:00
Makefile.crc32c.include
Makefile.leveldb.include
Makefile.minisketch.include
Makefile.qt.include
Makefile.qt_locale.include
Makefile.qttest.include
Makefile.test.include tests: framework for testing DepGraph class 2024-07-25 10:16:37 -04:00
Makefile.test_fuzz.include
Makefile.test_util.include tests: framework for testing DepGraph class 2024-07-25 10:16:37 -04:00
Makefile.univalue.include
mapport.cpp upnp: add compatibility for miniupnpc 2.2.8 2024-06-18 12:24:48 +00:00
mapport.h
memusage.h
merkleblock.cpp
merkleblock.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
net.cpp Merge bitcoin/bitcoin#22729: Make it possible to disable Tor binds and abort startup on bind failure 2024-07-16 16:27:24 -04:00
net.h Merge bitcoin/bitcoin#30394: net: fix race condition in self-connect detection 2024-07-16 09:40:53 +01:00
net_permissions.cpp
net_permissions.h
net_processing.cpp m_tx_download_mutex followups 2024-07-25 11:01:22 +01:00
net_processing.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
net_types.cpp
net_types.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
netaddress.cpp
netaddress.h random: get rid of GetRand by inlining 2024-07-01 12:39:53 -04:00
netbase.cpp Merge bitcoin/bitcoin#30245: net: Allow -proxy=[::1] on nodes with IPV6 lo only 2024-07-18 17:51:16 -04:00
netbase.h netbase: extend CreateSock() to support creating arbitrary sockets 2024-06-14 14:23:50 +02:00
netgroup.cpp
netgroup.h
netmessagemaker.h
noui.cpp
noui.h
outputtype.cpp
outputtype.h
pow.cpp
pow.h
prevector.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
protocol.cpp
protocol.h
psbt.cpp
psbt.h Merge bitcoin/bitcoin#30406: refactor: modernize-use-equals-default 2024-07-11 19:08:46 +01:00
pubkey.cpp
pubkey.h
random.cpp random: replace construct/assign with explicit Reseed() 2024-07-01 12:39:57 -04:00
random.h random: drop ad-hoc Shuffle in favor of std::shuffle 2024-07-06 09:06:36 -04:00
randomenv.cpp Fix MSVC warning C4273 "inconsistent dll linkage" 2024-07-19 22:01:01 +01:00
randomenv.h
rest.cpp refactor: Replace ParseHashStr with FromHex 2024-07-24 17:40:18 +02:00
rest.h
reverse_iterator.h
scheduler.cpp
scheduler.h
serialize.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
signet.cpp
signet.h
span.h
streams.cpp
streams.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
sync.cpp
sync.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
threadsafety.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
tinyformat.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00
torcontrol.cpp
torcontrol.h
txdb.cpp
txdb.h
txmempool.cpp random: get rid of GetRand by inlining 2024-07-01 12:39:53 -04:00
txmempool.h doc: use proper doxygen formatting for CTxMemPool::cs 2024-07-23 12:21:41 +02:00
txorphanage.cpp [refactor] delete EraseTxNoLock, just use EraseTx 2024-07-16 10:21:41 +01:00
txorphanage.h [doc] TxOrphanage is no longer thread-safe 2024-07-24 10:38:35 +01:00
txrequest.cpp random: get rid of GetRand by inlining 2024-07-01 12:39:53 -04:00
txrequest.h
uint256.cpp scripted-diff: Rename SetHex to SetHexDeprecated 2024-07-24 09:15:34 +02:00
uint256.h refactor: Implement strict uint256::FromHex() 2024-07-24 17:38:06 +02:00
undo.h
validation.cpp [refactor] change ActiveTipChange to use CBlockIndex ref instead of ptr 2024-07-25 11:01:22 +01:00
validation.h refactor: Make m_last_notified_header private 2024-07-17 09:12:28 +02:00
validationinterface.cpp [refactor] change ActiveTipChange to use CBlockIndex ref instead of ptr 2024-07-25 11:01:22 +01:00
validationinterface.h [refactor] change ActiveTipChange to use CBlockIndex ref instead of ptr 2024-07-25 11:01:22 +01:00
versionbits.cpp
versionbits.h
walletinitinterface.h tidy: modernize-use-equals-default 2024-07-08 11:12:01 +02:00