Skip to content

Commit

Permalink
Merge pull request #755 from onflow/use-indexed-height-for-payer-bala…
Browse files Browse the repository at this point in the history
…nce-check

Added indexed height method
  • Loading branch information
peterargue authored Oct 2, 2024
2 parents eff70fd + 5a585a6 commit b5273bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions emulator/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ func (b *blocks) SealedHeader() (*flowgo.Header, error) {
return block.Header, nil
}

func (b *blocks) IndexedHeight() (uint64, error) {
block, err := b.blockchain.storage.LatestBlock(context.Background())
if err != nil {
return 0, err
}

return block.Header.Height, nil
}

// We don't have to do anything complex here, as emulator does not fork the chain
func (b *blocks) ByHeightFrom(height uint64, header *flowgo.Header) (*flowgo.Header, error) {
if height > header.Height {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/onflow/cadence v1.0.0
github.com/onflow/crypto v0.25.2
github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1
github.com/onflow/flow-go v0.38.0-preview.0.0.20241001140429-ec4ad1cf1c8a
github.com/onflow/flow-go v0.38.0-preview.0.0.20241002124048-21cfe5aea5a8
github.com/onflow/flow-go-sdk v1.0.0
github.com/onflow/flow-nft/lib/go/contracts v1.2.1
github.com/onflow/flow/protobuf/go/flow v0.4.7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2059,8 +2059,8 @@ github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/
github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs=
github.com/onflow/flow-ft/lib/go/templates v1.0.0/go.mod h1:uQ8XFqmMK2jxyBSVrmyuwdWjTEb+6zGjRYotfDJ5pAE=
github.com/onflow/flow-go v0.38.0-preview.0.0.20241001140429-ec4ad1cf1c8a h1:WjEBqoO29zWK4gMn41dHOEbA0L0i+u792HdUQGtpdig=
github.com/onflow/flow-go v0.38.0-preview.0.0.20241001140429-ec4ad1cf1c8a/go.mod h1:kdaRKWlvm1vC8Lhf2uI4XvDxS+AvfWvrWZr2CFOz8y8=
github.com/onflow/flow-go v0.38.0-preview.0.0.20241002124048-21cfe5aea5a8 h1:gQcr59aPL9YjsUkgYwcc8ec8h2bw3ttX03553S/aW34=
github.com/onflow/flow-go v0.38.0-preview.0.0.20241002124048-21cfe5aea5a8/go.mod h1:kdaRKWlvm1vC8Lhf2uI4XvDxS+AvfWvrWZr2CFOz8y8=
github.com/onflow/flow-go-sdk v1.0.0-M1/go.mod h1:TDW0MNuCs4SvqYRUzkbRnRmHQL1h4X8wURsCw9P9beo=
github.com/onflow/flow-go-sdk v1.0.0 h1:Ha4fQm1MMKsyaqMkQLCN3rA/yaQKG6DGwiIfx06j40c=
github.com/onflow/flow-go-sdk v1.0.0/go.mod h1:iZkW2IWieVUZKK06mQCxpjJzPDgS0VtGpTaP/rKu6J4=
Expand Down

0 comments on commit b5273bf

Please sign in to comment.