Bugfix: BTC node version 23.0 changed "address" form in RPC return value

This commit is contained in:
Rucknium 2022-07-26 18:42:45 +00:00
parent a5d2e9f458
commit c0af6a5862

View file

@ -89,7 +89,17 @@ for (height.set in heights.to.process) {
value <- vector("numeric", length(latest.tx$vout) ) value <- vector("numeric", length(latest.tx$vout) )
for (j in seq_along(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) { if (length(extracted.address) > 1) {
extracted.address <- list(paste0(sort(unlist(extracted.address)), collapse = "|")) extracted.address <- list(paste0(sort(unlist(extracted.address)), collapse = "|"))
# sort() so that the address order is always the same # sort() so that the address order is always the same