Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix underflow when broadcasting storage proof for expired contracts #132

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

n8maninger
Copy link
Member

Fixes a panic when reducing the collateral metric of a contract that does not need a storage proof.

panic: underflow

goroutine 39 [running]:
go.sia.tech/core/types.Currency.Sub(...)
      go.sia.tech/[email protected]/types/currency.go:97
, 0x0?}, 0x1, {0xc12ab85287de76a2, 0x29326ed31, 0x1c593c0})
      go.sia.tech/hostd/persist/sqlite/metrics.go:423 +0x479
go.sia.tech/hostd/persist/sqlite.(*Store).ExpireContract.func1({0x15f3c08, 0xc000592460})
      go.sia.tech/hostd/persist/sqlite/contracts.go:458 +0x212
go.sia.tech/hostd/persist/sqlite.(*Store).transaction(0xc000116360, {0x15f35b0, 0xc0008d4690}, 0xc0000f7ba0)
      go.sia.tech/hostd/persist/sqlite/store.go:108 +0x669
go.sia.tech/hostd/persist/sqlite.(*Store).ExpireContract(0x2?, {0xcb, 0x89, 0x9b, 0x90, 0xf2, 0xde, 0xd9, 0x84, 0x88, ...}, ...)
      go.sia.tech/hostd/persist/sqlite/contracts.go:449 +0xbe
go.sia.tech/hostd/host/contracts.(*ContractManager).handleContractAction(0xc0003a8c60, {0xcb, 0x89, 0x9b, 0x90, 0xf2, 0xde, 0xd9, 0x84, 0x88, ...}, ...)
      go.sia.tech/hostd/host/contracts/actions.go:159 +0x195a
go.sia.tech/hostd/persist/sqlite.(*Store).ContractAction(0xc000116360, 0xc0006ba380?, 0xc000592160)
      go.sia.tech/hostd/persist/sqlite/contracts.go:417 +0x423
go.sia.tech/hostd/host/contracts.(*ContractManager).processActions.func1(0xc0003a8c60, 0xc0000f9e80?)
      go.sia.tech/hostd/host/contracts/actions.go:66 +0xaa
go.sia.tech/hostd/host/contracts.(*ContractManager).processActions(0xc0003a8c60)
      go.sia.tech/hostd/host/contracts/actions.go:73 +0xa5
created by go.sia.tech/hostd/host/contracts.NewManager
      go.sia.tech/hostd/host/contracts/manager.go:484 +0x38a

@n8maninger n8maninger merged commit 1d07b2b into master Aug 2, 2023
6 checks passed
@n8maninger n8maninger deleted the nate/fix-null-panic branch August 2, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant