You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throwJSONRPCError(RPC_INVALID_PARAMETER, "Given claim_script does not match the given Bitcoin transaction.");
433
+
} else {
434
+
throwJSONRPCError(RPC_INVALID_PARAMETER, "Failed to find output in bitcoinTx to the mainchain_address from getpeginaddress");
435
+
}
436
+
}
437
+
assert(witness_script != CScript());
438
+
439
+
int version = -1;
440
+
std::vector<unsignedchar> witness_program;
441
+
if (!witness_script.IsWitnessProgram(version, witness_program) || version != 0) {
442
+
throwJSONRPCError(RPC_INVALID_PARAMETER, "Given or recovered script is not a v0 witness program.");
443
+
}
444
+
445
+
CAmount value = 0;
446
+
if (!GetAmountFromParentChainPegin(value, *txBTCRef, nOut)) {
447
+
throwJSONRPCError(RPC_INVALID_PARAMETER, strprintf("Amounts to pegin must be explicit and asset must be %s", Params().GetConsensus().parent_pegged_asset.GetHex()));
for (std::map<CTxDestination, CAddressBookData>::const_iterator iter = pwallet->mapAddressBook.begin(); iter != pwallet->mapAddressBook.end(); ++iter) {
throwJSONRPCError(RPC_INVALID_PARAMETER, "Failed to find output in bitcoinTx to the mainchain_address from getpeginaddress");
5519
-
}
5520
-
assert(witness_script != CScript());
5521
5464
5522
-
int version = -1;
5523
-
std::vector<unsignedchar> witness_program;
5524
-
if (!witness_script.IsWitnessProgram(version, witness_program) || version != 0) {
5525
-
throwJSONRPCError(RPC_INVALID_PARAMETER, "Given or recovered script is not a v0 witness program.");
5526
-
}
5465
+
// Make the tx
5466
+
CMutableTransaction mtx;
5527
5467
5528
-
CAmount value = 0;
5529
-
if (!GetAmountFromParentChainPegin(value, txBTC, nOut)) {
5530
-
throwJSONRPCError(RPC_INVALID_PARAMETER, strprintf("Amounts to pegin must be explicit and asset must be %s", Params().GetConsensus().parent_pegged_asset.GetHex()));
// Peg-in witness isn't valid, even though the block header is(without depth check)
5560
-
// We re-check depth before returning with more descriptive result
5561
-
std::string err;
5562
-
if (!IsValidPeginWitness(pegin_witness, fedpegscripts, mtx.vin[0].prevout, err, false)) {
5563
-
throwJSONRPCError(RPC_INVALID_PARAMETER, strprintf("Constructed peg-in witness is invalid: %s", err));
5486
+
// Get value for output
5487
+
CAmount value = 0;
5488
+
if (!GetAmountFromParentChainPegin(value, *txBTCRef, mtx.vin[0].prevout.n)) {
5489
+
throwJSONRPCError(RPC_INVALID_PARAMETER, strprintf("Amounts to pegin must be explicit and asset must be %s", Params().GetConsensus().parent_pegged_asset.GetHex()));
0 commit comments