aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-10-31 14:59:34 +0000
committerfanquake <fanquake@gmail.com>2022-10-31 15:04:41 +0000
commit2e8880abc04d34fb44441606281a3f97bade3e13 (patch)
tree1e1ac69ff2bd90747d87601056102d9198317658 /src
parenta8f014b3427537a1e294cc7148ef615a45d01828 (diff)
parentd5701900fcf70220701a1686588114db165dce1c (diff)
downloadbitcoin-2e8880abc04d34fb44441606281a3f97bade3e13.tar.xz
Merge bitcoin/bitcoin#26410: [24.x] rc3 backports
d5701900fcf70220701a1686588114db165dce1c rpc: make `address` field optional (w0xlt) e4b8c9b2bf2118064e68d33f6b7207e721ae03dd rpc: add non-regression test about deriveaddresses crash when index is 2147483647 (muxator) bf2bf73bcbc5277074f1211c20b71995a175c314 rpc: fix crash in deriveaddresses when derivation index is 2147483647 (muxator) b04f5f960893983400e07b96dbe9fe68383a21d2 test: Test for out of bounds vout in sendall (Andrew Chow) dedee6af572471b9beeebca9543934e788484b2e wallet: Check utxo prevout index out of bounds in sendall (Andrew Chow) 931db785ee6f5c34e0f053314bc8c70b01642b72 test: Test that sendall works with watchonly spending specific utxos (Andrew Chow) bbe864a13a2e5ce15674eda5c3760ee851120c63 wallet: Correctly check ismine for sendall (Andrew Chow) 4b7d30d026815dbe2330cd3e2edc044835a3eaed Adjust `.tx/config` for new Transifex CLI (Hennadii Stepanov) Pull request description: Backports: * https://github.com/bitcoin/bitcoin/pull/26321 * https://github.com/bitcoin/bitcoin/pull/26344 * https://github.com/bitcoin/bitcoin/pull/26275 * https://github.com/bitcoin/bitcoin/pull/26349 ACKs for top commit: instagibbs: ACK https://github.com/bitcoin/bitcoin/pull/26410/commits/d5701900fcf70220701a1686588114db165dce1c hebasto: ACK d5701900fcf70220701a1686588114db165dce1c, I've cherry-picked commits manually and got zero diff with this PR branch. Tree-SHA512: dad64f4074b4f06d666c0f2d804eda92df241bcce0a49c28486311a151f2e9d46b75e1bce02de570dcc85957c9ce936debb2a4faa045800c9757c6c495115d7c
Diffstat (limited to 'src')
-rw-r--r--src/rpc/output_script.cpp2
-rw-r--r--src/wallet/rpc/spend.cpp2
-rw-r--r--src/wallet/rpc/transactions.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/rpc/output_script.cpp b/src/rpc/output_script.cpp
index 744f809814..a980c609e8 100644
--- a/src/rpc/output_script.cpp
+++ b/src/rpc/output_script.cpp
@@ -273,7 +273,7 @@ static RPCHelpMan deriveaddresses()
UniValue addresses(UniValue::VARR);
- for (int i = range_begin; i <= range_end; ++i) {
+ for (int64_t i = range_begin; i <= range_end; ++i) {
FlatSigningProvider provider;
std::vector<CScript> scripts;
if (!desc->Expand(i, key_provider, scripts, provider)) {
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index e38b13624c..bc65cbf7bf 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -1380,7 +1380,7 @@ RPCHelpMan sendall()
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Input not available. UTXO (%s:%d) was already spent.", input.prevout.hash.ToString(), input.prevout.n));
}
const CWalletTx* tx{pwallet->GetWalletTx(input.prevout.hash)};
- if (!tx || pwallet->IsMine(tx->tx->vout[input.prevout.n]) != (coin_control.fAllowWatchOnly ? ISMINE_ALL : ISMINE_SPENDABLE)) {
+ if (!tx || input.prevout.n >= tx->tx->vout.size() || !(pwallet->IsMine(tx->tx->vout[input.prevout.n]) & (coin_control.fAllowWatchOnly ? ISMINE_ALL : ISMINE_SPENDABLE))) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Input not found. UTXO (%s:%d) is not part of wallet.", input.prevout.hash.ToString(), input.prevout.n));
}
total_input_value += tx->tx->vout[input.prevout.n].nValue;
diff --git a/src/wallet/rpc/transactions.cpp b/src/wallet/rpc/transactions.cpp
index 0e13e4756b..6b9ec8ce10 100644
--- a/src/wallet/rpc/transactions.cpp
+++ b/src/wallet/rpc/transactions.cpp
@@ -447,7 +447,7 @@ RPCHelpMan listtransactions()
{RPCResult::Type::OBJ, "", "", Cat(Cat<std::vector<RPCResult>>(
{
{RPCResult::Type::BOOL, "involvesWatchonly", /*optional=*/true, "Only returns true if imported addresses were involved in transaction."},
- {RPCResult::Type::STR, "address", "The bitcoin address of the transaction."},
+ {RPCResult::Type::STR, "address", /*optional=*/true, "The bitcoin address of the transaction (not returned if the output does not have an address, e.g. OP_RETURN null data)."},
{RPCResult::Type::STR, "category", "The transaction category.\n"
"\"send\" Transactions sent.\n"
"\"receive\" Non-coinbase transactions received.\n"
@@ -561,7 +561,7 @@ RPCHelpMan listsinceblock()
{RPCResult::Type::OBJ, "", "", Cat(Cat<std::vector<RPCResult>>(
{
{RPCResult::Type::BOOL, "involvesWatchonly", /*optional=*/true, "Only returns true if imported addresses were involved in transaction."},
- {RPCResult::Type::STR, "address", "The bitcoin address of the transaction."},
+ {RPCResult::Type::STR, "address", /*optional=*/true, "The bitcoin address of the transaction (not returned if the output does not have an address, e.g. OP_RETURN null data)."},
{RPCResult::Type::STR, "category", "The transaction category.\n"
"\"send\" Transactions sent.\n"
"\"receive\" Non-coinbase transactions received.\n"