Skip to content

Commit

Permalink
Release/v0.0.5 (#209)
Browse files Browse the repository at this point in the history
* Bug fixes on fast sync

* Revert some changes

* Try to fix go linter

* Increase block time and fix utxo ids errors
  • Loading branch information
vtleonardo committed Aug 23, 2022
1 parent 4905edf commit 59b8be5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 10 deletions.
57 changes: 48 additions & 9 deletions application/utxohandler/utxohandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,17 @@ func (ut *UTXOHandler) addOneFastSync(txn *badger.Txn, utxo *objs.TXOut) error {
utils.DebugTrace(ut.logger, err)
return err
}
value, err := utxo.Value()
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
err = ut.valueIndex.Add(txn, utxoID, owner, value)
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
if !utxo.IsDeposit() {
value, err := utxo.Value()
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
err = ut.valueIndex.Add(txn, utxoID, owner, value)
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
}
default:
panic("utxoHandler.addOneFastSync; utxo type not defined")
Expand Down Expand Up @@ -824,6 +826,43 @@ func (ut *UTXOHandler) StoreSnapShotStateData(txn *badger.Txn, utxoID, preHash,
}
return errorz.ErrInvalid{}.New(fmt.Sprintf("utxoHandler.StoreSnapShotStateData; utxoID does not match calcUtxoID; utxoID: %x; calcUtxoID: %x calcTxHash: %x TxOutIdx: %v", utxoID, calcUtxoID, calcTxHash, utxoIdxOut))
}
if utxo.IsDeposit() {
value, err := utxo.Value()
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
genericOwner, err := utxo.GenericOwner()
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
account := genericOwner.Account

expectedAccount, err := utils.DecodeHexString("0xba7809a4114eef598132461f3202b5013e834cd5")
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
expectedValue, err := new(uint256.Uint256).FromUint64(500000000000)
if err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
if !bytes.Equal(account, expectedAccount) || !value.Eq(expectedValue) {
return errorz.ErrInvalid{}.New(
fmt.Sprintf(
"Bad deposit; account: %x value: %s", account, value.String(),
),
)
}

if err := ut.addOneFastSync(txn, utxo); err != nil {
utils.DebugTrace(ut.logger, err)
return err
}
return nil
}
calcPreHash, err := utxo.PreHash()
if err != nil {
utils.DebugTrace(ut.logger, err)
Expand Down
2 changes: 1 addition & 1 deletion dynamics/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const (
maxProposalSize = maxBytes // Parameterize: equal to maxBytes
msgTimeout = 4 * time.Second
srvrMsgTimeout = (3 * msgTimeout) / 4 // Parameterize: 0.75*MsgTimeout
proposalStepTO = 4 * time.Second
proposalStepTO = 600 * time.Second
preVoteStepTO = 3 * time.Second
preCommitStepTO = 3 * time.Second
dBRNRTO = (5 * (proposalStepTO + preVoteStepTO + preCommitStepTO)) / 2 // Parameterize: make 2.5 times Prop, PV, PC timeouts
Expand Down

0 comments on commit 59b8be5

Please sign in to comment.