aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-03-18 13:22:06 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-03-18 13:22:15 -0400
commitc033c4b5cef89a654e4d9d5c5f9bd823871b068b (patch)
tree6010a8bf7db2b77c656dcc5e12a9b390cbebf9a0 /src/validation.cpp
parent2c336a9ccdf4434a0c80b83ea348bdfff9cea62b (diff)
parent7abd2e697c0f8e93245e09ac853bae05d0b48bee (diff)
Merge #13541: wallet/rpc: sendrawtransaction maxfeerate
7abd2e697c wallet/rpc: add maxfeerate parameter to testmempoolaccept (Karl-Johan Alm) 6c0a6f73e3 wallet/rpc: add maxfeerate parameter to sendrawtransaction (Karl-Johan Alm) e5efacb941 test: Refactor vout fetches in rpc_rawtransaction (Karl-Johan Alm) Pull request description: This adds a new `maxfeerate` parameter to `sendrawtransaction` which forces the node to reject a transaction whose feerate is above the given fee rate. This is a safety harness from shooting yourself in the foot and accidentally overpaying fees. See also #12911. Tree-SHA512: efa50134a7c17c9330cfdfd48ba400e095c0a419cc45e630618d8b44929c25d780d1bb2710c1fbbb6e687eca373505b0338cdaa7f2ff4ca22636d84c31557a2e
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index a9b5bcf4a4..97f51d2968 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3159,6 +3159,26 @@ static int GetWitnessCommitmentIndex(const CBlock& block)
return commitpos;
}
+// Compute at which vout of the block's coinbase transaction the signet
+// signature occurs, or -1 if not found.
+static int GetSignetSignatureIndex(const CBlock& block)
+{
+ if (!block.vtx.empty()) {
+ for (size_t o = 0; o < block.vtx[0]->vout.size(); o++) {
+ if (block.vtx[0]->vout[o].scriptPubKey.size() >= 68 // at minimum 64 byte signature plus script/header data
+ && block.vtx[0]->vout[o].scriptPubKey[0] == OP_RETURN // unspendable
+ && block.vtx[0]->vout[o].scriptPubKey[1] == block.vtx[0]->vout[o].scriptPubKey.size() - 1 // push the rest
+ && block.vtx[0]->vout[o].scriptPubKey[2] == 0xec // 's' ^ 0x9f
+ && block.vtx[0]->vout[o].scriptPubKey[3] == 0xc7 // 'i' ^ 0xae
+ && block.vtx[0]->vout[o].scriptPubKey[4] == 0xda // 'g' ^ 0xbd
+ && block.vtx[0]->vout[o].scriptPubKey[5] == 0xa2) { // 'n' ^ 0xcc
+ return (int)o;
+ }
+ }
+ }
+ return -1;
+}
+
void UpdateUncommittedBlockStructures(CBlock& block, const CBlockIndex* pindexPrev, const Consensus::Params& consensusParams)
{
int commitpos = GetWitnessCommitmentIndex(block);