Skip to content

Commit

Permalink
Merge pull request #516 from iotaledger/fix/genesis-slot-in-snapshot
Browse files Browse the repository at this point in the history
Fixed the genesis ledger having the outputs always booked at slot 0 instead of the genesis slot
  • Loading branch information
karimodm authored Nov 13, 2023
2 parents 4e99339 + 4d0592d commit f3c1f3c
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 f3c1f3c

Please sign in to comment.