-
Notifications
You must be signed in to change notification settings - Fork 741
stop persisting rejected blocks on P-chain #1696
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
Changes from all commits
db9f558
be195aa
6fdb824
9b75120
2fb4f16
bb00fb9
eb0598a
98d5554
53a1d00
02a04f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,9 @@ type State interface { | |
SetLastAccepted(blkID ids.ID) | ||
|
||
GetStatelessBlock(blockID ids.ID) (blocks.Block, choices.Status, error) | ||
AddStatelessBlock(block blocks.Block, status choices.Status) | ||
|
||
// Invariant: [block] is an accepted block. | ||
AddStatelessBlock(block blocks.Block) | ||
|
||
// ValidatorSet adds all the validators and delegators of [subnetID] into | ||
// [vdrs]. | ||
|
@@ -1023,7 +1025,7 @@ func (s *state) syncGenesis(genesisBlk blocks.Block, genesis *genesis.State) err | |
s.SetLastAccepted(genesisBlkID) | ||
s.SetTimestamp(time.Unix(int64(genesis.Timestamp), 0)) | ||
s.SetCurrentSupply(constants.PrimaryNetworkID, genesis.InitialSupply) | ||
s.AddStatelessBlock(genesisBlk, choices.Accepted) | ||
s.AddStatelessBlock(genesisBlk) | ||
|
||
// Persist UTXOs that exist at genesis | ||
for _, utxo := range genesis.UTXOs { | ||
|
@@ -1486,11 +1488,11 @@ func (s *state) init(genesisBytes []byte) error { | |
return s.Commit() | ||
} | ||
|
||
func (s *state) AddStatelessBlock(block blocks.Block, status choices.Status) { | ||
func (s *state) AddStatelessBlock(block blocks.Block) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should we err if the block status is not actually accepted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have that information here. |
||
s.addedBlocks[block.ID()] = stateBlk{ | ||
Blk: block, | ||
Bytes: block.Bytes(), | ||
Status: status, | ||
Status: choices.Accepted, | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we rename this AddStatelessAcceptedBlock for clarify? Maybe it's too long of name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this change would be reverted when we remove status from
GetStatelessBlock