aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2017-02-03 19:23:22 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2017-06-05 23:14:34 +0000
commit9a5a1d7d452eff242be1bfe155a30c1f05b2d5a4 (patch)
tree227405115d3b6f542090b9d1d88ea78d1eedf42f
parent23b0fe34f526693985099d9160806d00d48a9ecd (diff)
downloadbitcoin-9a5a1d7d452eff242be1bfe155a30c1f05b2d5a4.tar.xz
RPC/rawtransaction: createrawtransaction: Check opt_into_rbf when provided with either value
-rw-r--r--src/Makefile.am2
-rw-r--r--src/rpc/rawtransaction.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ae2eb29c94..199d60b725 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -198,6 +198,7 @@ libbitcoin_server_a_SOURCES = \
noui.cpp \
policy/fees.cpp \
policy/policy.cpp \
+ policy/rbf.cpp \
pow.cpp \
rest.cpp \
rpc/blockchain.cpp \
@@ -240,7 +241,6 @@ libbitcoin_wallet_a_SOURCES = \
wallet/rpcwallet.cpp \
wallet/wallet.cpp \
wallet/walletdb.cpp \
- policy/rbf.cpp \
$(BITCOIN_CORE_H)
# crypto primitives library
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 332dbc08a3..00ddd9d16f 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -316,7 +316,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
" ,...\n"
" }\n"
"3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n"
- "4. optintorbf (boolean, optional, default=false) Allow this transaction to be replaced by a transaction with higher fees\n"
+ "4. optintorbf (boolean, optional, default=false) Allow this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.\n"
"\nResult:\n"
"\"transaction\" (string) hex string of the transaction\n"
@@ -373,8 +373,6 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
int64_t seqNr64 = sequenceObj.get_int64();
if (seqNr64 < 0 || seqNr64 > std::numeric_limits<uint32_t>::max()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, sequence number is out of range");
- } else if (seqNr64 <= MAX_BIP125_RBF_SEQUENCE && request.params.size() > 3 && request.params[3].isFalse()) {
- throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: Sequence number contradicts optintorbf option");
} else {
nSequence = (uint32_t)seqNr64;
}
@@ -411,6 +409,10 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
}
}
+ if (request.params.size() > 3 && rbfOptIn != SignalsOptInRBF(rawTx)) {
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter combination: Sequence number(s) contradict optintorbf option");
+ }
+
return EncodeHexTx(rawTx);
}