Skip to content

Commit 0502fc0

Browse files
authored
fix: check for nil assets in collateral return (#944)
Signed-off-by: Aurora Gaffney <[email protected]>
1 parent ce98f6f commit 0502fc0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ledger/babbage/rules.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,11 @@ func UtxoValidateCollateralContainsNonAda(
153153
// Check if all collateral assets are accounted for in the collateral return
154154
collReturn := tx.CollateralReturn()
155155
if collReturn != nil {
156-
if collReturn.Assets().Compare(&totalAssets) {
157-
return nil
156+
collReturnAssets := collReturn.Assets()
157+
if collReturnAssets != nil {
158+
if collReturnAssets.Compare(&totalAssets) {
159+
return nil
160+
}
158161
}
159162
}
160163
return alonzo.CollateralContainsNonAdaError{

ledger/conway/rules.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@ func UtxoValidateCollateralContainsNonAda(
178178
// Check if all collateral assets are accounted for in the collateral return
179179
collReturn := tx.CollateralReturn()
180180
if collReturn != nil {
181-
if collReturn.Assets().Compare(&totalAssets) {
182-
return nil
181+
collReturnAssets := collReturn.Assets()
182+
if collReturnAssets != nil {
183+
if collReturnAssets.Compare(&totalAssets) {
184+
return nil
185+
}
183186
}
184187
}
185188
return alonzo.CollateralContainsNonAdaError{

0 commit comments

Comments
 (0)