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:
KtorZ 2023-02-14 15:58:34 +01:00
parent 251aa756d9
commit 34596b3084
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 3 additions and 5 deletions

View File

@ -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);
} }
} }