Merge pull request #3435 from nspcc-dev/extend-compare-scripts
scripts: dump diff for OnPersist and PostPersist applog
This commit is contained in:
commit
0435551eee
1 changed files with 31 additions and 21 deletions
|
@ -118,13 +118,24 @@ func cliMain(c *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
fmt.Printf("state differs at %d, block %s\n", h, blk.Hash().StringLE())
|
||||
dumpApplogDiff(true, blk.Hash(), a, b, ca, cb)
|
||||
for _, t := range blk.Transactions {
|
||||
fmt.Printf("transaction %s:\n", t.Hash().StringLE())
|
||||
la, err := ca.GetApplicationLog(t.Hash(), nil)
|
||||
dumpApplogDiff(false, t.Hash(), a, b, ca, cb)
|
||||
}
|
||||
return errors.New("different state found")
|
||||
}
|
||||
|
||||
func dumpApplogDiff(isBlock bool, container util.Uint256, a string, b string, ca *rpcclient.Client, cb *rpcclient.Client) error {
|
||||
if isBlock {
|
||||
fmt.Printf("block %s:\n", container.StringLE())
|
||||
} else {
|
||||
fmt.Printf("transaction %s:\n", container.StringLE())
|
||||
}
|
||||
la, err := ca.GetApplicationLog(container, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
lb, err := cb.GetApplicationLog(t.Hash(), nil)
|
||||
lb, err := cb.GetApplicationLog(container, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -140,8 +151,7 @@ func cliMain(c *cli.Context) error {
|
|||
Context: 1,
|
||||
})
|
||||
fmt.Println(diff)
|
||||
}
|
||||
return errors.New("different state found")
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
Loading…
Reference in a new issue