mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge #322: add better reject reason for immature peg-in, with test
20dee2eslight peg-test language fixup (Gregory Sanders)248eb91add better reject reason for immature peg-in, with test (Gregory Sanders)
This commit is contained in:
commit
257602efc1
2 changed files with 17 additions and 3 deletions
|
|
@ -3660,7 +3660,11 @@ UniValue createrawpegin(const JSONRPCRequest& request)
|
|||
stack.push_back(txData);
|
||||
stack.push_back(txOutProofData);
|
||||
|
||||
if (!IsValidPeginWitness(pegin_witness, mtx.vin[0].prevout)) {
|
||||
// Peg-in witness isn't valid, even though the block header is(without depth check)
|
||||
// We re-check depth before returning with more descriptive result
|
||||
if (GetBoolArg("-validatepegin", DEFAULT_VALIDATE_PEGIN) &&
|
||||
!IsConfirmedBitcoinBlock(merkleBlock.header.GetHash(), 0) &&
|
||||
!IsValidPeginWitness(pegin_witness, mtx.vin[0].prevout)) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Constructed peg-in witness is invalid.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue