Fix collecting withdrawal scripts in eval_phase_one
The current implementation assumed that ALL withdrawals present in a transaction had to be locked by a script and failed otherwise. But a transaction can actually be composed of both. So instead of failing, we should rather just ignore withdrawals that can't be referenced by redeemers.
This commit is contained in:
parent
251aa756d9
commit
34596b3084
|
@ -283,15 +283,13 @@ fn build_redeemer_ptr(
|
||||||
for (idx, x) in reward_accounts.iter().enumerate() {
|
for (idx, x) in reward_accounts.iter().enumerate() {
|
||||||
let cred = match Address::from_bytes(x).unwrap() {
|
let cred = match Address::from_bytes(x).unwrap() {
|
||||||
Address::Stake(a) => match a.payload() {
|
Address::Stake(a) => match a.payload() {
|
||||||
StakePayload::Script(sh) => StakeCredential::Scripthash(*sh),
|
StakePayload::Script(sh) => Some(StakeCredential::Scripthash(*sh)),
|
||||||
StakePayload::Stake(_) => {
|
StakePayload::Stake(_) => None,
|
||||||
return Err(Error::ScriptKeyHash);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
_ => return Err(Error::BadWithdrawalAddress),
|
_ => return Err(Error::BadWithdrawalAddress),
|
||||||
};
|
};
|
||||||
|
|
||||||
if cred == *racnt {
|
if cred == Some(racnt.to_owned()) {
|
||||||
maybe_idx = Some(idx);
|
maybe_idx = Some(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue