aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
diff options
context:
space:
mode:
authorMeshCollider <dobsonsa68@gmail.com>2019-04-27 15:29:30 +1200
committerMeshCollider <dobsonsa68@gmail.com>2019-04-27 15:29:48 +1200
commit703414994aa46c8f7d37ff66c77573ae6e7dcb20 (patch)
treefdead92a2f32fe47be2506c54b15191e570b6060 /src/rpc/rawtransaction.cpp
parent65ec4d6fb2be79034d814531daab30541c6e5985 (diff)
parent99e88a3726c2325e3a3a35c0a750bde25bd58ad0 (diff)
Merge #15784: rpc: Remove dependency on interfaces::Chain in SignTransaction
99e88a372 rpc: Remove dependency on interfaces::Chain in SignTransaction (Antoine Riard) Pull request description: Assuming wallet RPCs and node RPCs will go into different processes, signrawtransactionwithkey doesn't need to access Coins via interfaces::Chain, it may use directly utility in node/coins.cpp Obviously will need rebase after #15638 Tree-SHA512: 42ee8fcbcd38643bbd82210db6f68249bed5ee036a4c930a1db534d0469a133e287b8869c977bf0cc79a7296dde04f72adb74d24e1cd20f4a280f4c2b7fceb74
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
-rw-r--r--src/rpc/rawtransaction.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 1a7216ceeb..78d7bbc80c 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -15,6 +15,7 @@
#include <key_io.h>
#include <keystore.h>
#include <merkleblock.h>
+#include <node/coin.h>
#include <node/psbt.h>
#include <node/transaction.h>
#include <policy/policy.h>
@@ -770,7 +771,14 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
keystore.AddKey(key);
}
- return SignTransaction(*g_rpc_interfaces->chain, mtx, request.params[2], &keystore, true, request.params[3]);
+ // Fetch previous transactions (inputs):
+ std::map<COutPoint, Coin> coins;
+ for (const CTxIn& txin : mtx.vin) {
+ coins[txin.prevout]; // Create empty map entry keyed by prevout.
+ }
+ FindCoins(coins);
+
+ return SignTransaction(mtx, request.params[2], &keystore, coins, true, request.params[3]);
}
static UniValue sendrawtransaction(const JSONRPCRequest& request)