mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-30 19:51:58 +00:00
Fix up commits, debug cli tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dummy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/tendermint/abci/types"
|
||||
@@ -33,6 +34,7 @@ func (app *DummyApplication) DeliverTx(tx []byte) types.Result {
|
||||
} else {
|
||||
app.state.Set(tx, tx)
|
||||
}
|
||||
fmt.Println("set data")
|
||||
return types.OK
|
||||
}
|
||||
|
||||
@@ -41,7 +43,20 @@ func (app *DummyApplication) CheckTx(tx []byte) types.Result {
|
||||
}
|
||||
|
||||
func (app *DummyApplication) Commit() types.Result {
|
||||
hash := app.state.Hash()
|
||||
// Save a new version
|
||||
var hash []byte
|
||||
var err error
|
||||
|
||||
if app.state.Size() > 0 {
|
||||
// just add one more to height (kind of arbitrarily stupid)
|
||||
height := app.state.LatestVersion() + 1
|
||||
hash, err = app.state.SaveVersion(height)
|
||||
if err != nil {
|
||||
// if this wasn't a dummy app, we'd do something smarter
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
return types.NewResultOK(hash, "")
|
||||
}
|
||||
|
||||
|
@@ -94,6 +94,7 @@ func (app *PersistentDummyApplication) Commit() types.Result {
|
||||
// Save a new version
|
||||
var appHash []byte
|
||||
var err error
|
||||
|
||||
if app.app.state.Size() > 0 {
|
||||
appHash, err = app.app.state.SaveVersion(app.height)
|
||||
if err != nil {
|
||||
@@ -103,12 +104,7 @@ func (app *PersistentDummyApplication) Commit() types.Result {
|
||||
app.logger.Info("Saved state", "root", appHash)
|
||||
}
|
||||
|
||||
lastBlock := LastBlockInfo{
|
||||
Height: app.height,
|
||||
AppHash: appHash, // this hash will be in the next block header
|
||||
}
|
||||
|
||||
app.logger.Info("Saving block", "height", lastBlock.Height, "root", lastBlock.AppHash)
|
||||
app.logger.Info("Commit block", "height", app.height, "root", appHash)
|
||||
return types.NewResultOK(appHash, "")
|
||||
}
|
||||
|
||||
|
@@ -2,21 +2,21 @@
|
||||
-> data: hello
|
||||
-> data.hex: 68656C6C6F
|
||||
|
||||
> info
|
||||
> info
|
||||
-> data: {"size":0}
|
||||
-> data.hex: 7B2273697A65223A307D
|
||||
|
||||
> commit
|
||||
> commit
|
||||
|
||||
> deliver_tx "abc"
|
||||
|
||||
> info
|
||||
> info
|
||||
-> data: {"size":1}
|
||||
-> data.hex: 7B2273697A65223A317D
|
||||
|
||||
> commit
|
||||
-> data: u<02>~<7E><><EFBFBD>X<EFBFBD>$<24>l<EFBFBD><6C>E<EFBFBD>
|
||||
-> data.hex: 750502FC7E84BBD788ED589624F06CFA871845D1
|
||||
> commit
|
||||
-> data: I<EFBFBD><EFBFBD>\ͬޮ<CDAC>(<28><01><><EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD>
|
||||
-> data.hex: 49DFD15CCDACDEAE9728CB01FBB5E8688CA58B91
|
||||
|
||||
> query "abc"
|
||||
-> log: exists
|
||||
@@ -26,9 +26,9 @@
|
||||
|
||||
> deliver_tx "def=xyz"
|
||||
|
||||
> commit
|
||||
-> data: v9;<3B>.E<02><>iLb<4C><62>Q<EFBFBD><51><EFBFBD><EFBFBD>
|
||||
-> data.hex: 76393B8A182E450286B0694C629ECB51B286EFD5
|
||||
> commit
|
||||
-> data: p-<2D>"<22>7?<3F>?<3F><><EFBFBD>* <20>,<2C>+
|
||||
-> data.hex: 70102DB32280373FBF3F9F89DA2A20CE2CD62B0B
|
||||
|
||||
> query "def"
|
||||
-> log: exists
|
||||
|
@@ -15,6 +15,7 @@ function testExample() {
|
||||
|
||||
echo "Example $N"
|
||||
$APP &> /dev/null &
|
||||
# $APP &> ./app.out &
|
||||
sleep 2
|
||||
abci-cli --verbose batch < "$INPUT" > "${INPUT}.out.new"
|
||||
killall "$APP"
|
||||
|
Reference in New Issue
Block a user