From c0af6a5862d7194d31ba8358d482ea1ad5c5be8e Mon Sep 17 00:00:00 2001 From: Rucknium Date: Tue, 26 Jul 2022 18:42:45 +0000 Subject: [PATCH] Bugfix: BTC node version 23.0 changed "address" form in RPC return value --- .../extract-tx-graphs.R | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/General-Blockchain-Age-of-Spent-Outputs/extract-tx-graphs.R b/General-Blockchain-Age-of-Spent-Outputs/extract-tx-graphs.R index 14cc76b..3de076c 100644 --- a/General-Blockchain-Age-of-Spent-Outputs/extract-tx-graphs.R +++ b/General-Blockchain-Age-of-Spent-Outputs/extract-tx-graphs.R @@ -89,7 +89,17 @@ for (height.set in heights.to.process) { value <- vector("numeric", length(latest.tx$vout) ) for (j in seq_along(latest.tx$vout)) { - extracted.address <- latest.tx$vout[[j]]$scriptPubKey$addresses + extracted.address <- latest.tx$vout[[j]]$scriptPubKey$address + # WARNING: This uses R's partial list name matching. + # In version bitcoin-23.0 of the BTC node daemon, this list element is + # named "address". Prior to bitcoin-23.0, it was "addresses": + # https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-23.0.md#updated-rpcs + # The name is "addresses" for these versions of the node daemons for BCH, LTC, and DOGE: + # bch-unlimited-1.10.0.0 + # litecoin-0.21.2.1 + # dogecoin-1.14.5 + # By using "address", the correct object will be found for all four coins. + if (length(extracted.address) > 1) { extracted.address <- list(paste0(sort(unlist(extracted.address)), collapse = "|")) # sort() so that the address order is always the same