Skip to content

Commit

Permalink
Fixed the genesis ledger having the outputs always booked at slot 0 i…
Browse files Browse the repository at this point in the history
…nstead of the genesis slot
  • Loading branch information
alexsporn committed Nov 13, 2023
1 parent 4e99339 commit 4d0592d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/testsuite/snapshotcreator/snapshotcreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ import (
// | node1 | node1 |
// | node2 | node2 |.

const (
GenesisTransactionCreationSlot = 0
)

var GenesisTransactionCommitment = iotago.IdentifierFromData([]byte("genesis"))

func CreateSnapshot(opts ...options.Option[Options]) error {
Expand Down Expand Up @@ -160,7 +156,7 @@ func CreateSnapshot(opts ...options.Option[Options]) error {

var accountLedgerOutputs utxoledger.Outputs
for idx, output := range genesisTransactionOutputs {
proof, err := iotago.NewOutputIDProof(engineInstance.LatestAPI(), GenesisTransactionCommitment, GenesisTransactionCreationSlot, genesisTransactionOutputs, uint16(idx))
proof, err := iotago.NewOutputIDProof(engineInstance.LatestAPI(), GenesisTransactionCommitment, api.ProtocolParameters().GenesisSlot(), genesisTransactionOutputs, uint16(idx))
if err != nil {
return err
}
Expand All @@ -171,7 +167,7 @@ func CreateSnapshot(opts ...options.Option[Options]) error {
return err
}

utxoOutput := utxoledger.CreateOutput(engineInstance, outputID, api.ProtocolParameters().GenesisBlockID(), GenesisTransactionCreationSlot, output, proof)
utxoOutput := utxoledger.CreateOutput(engineInstance, outputID, api.ProtocolParameters().GenesisBlockID(), api.ProtocolParameters().GenesisSlot(), output, proof)
if err := engineInstance.Ledger.AddGenesisUnspentOutput(utxoOutput); err != nil {
return err
}
Expand Down

0 comments on commit 4d0592d

Please sign in to comment.