-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Bug Report
Invalid memory address or nil pointer dereference error occurs in dao withdrawal transaction is reported
Current Behavior
Expected Behavior
I expect developer can use this dao withdraw example normal
Environment
- CKB version: ckb v111
- Chain: /
- Operating system:
MacOS 12.1 - Arch: x64
- Installation: /
Additional context/Screenshots
This bug can reproduced by these steps:
func Test_WithdrawDaoExample(t *testing.T) {
sender := "ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2qf8keemy2p5uu0g0gn8cd4ju23s5269qk8rg4r"
depositOutPoint := &types.OutPoint{
TxHash: types.HexToHash("0xebfb7bff39985865c20bd5b6c0190e58298eb9e4b1ddb9daee16166bed658c40"),
Index: 0,
}
network := types.NetworkTest
client, err := rpc.Dial("https://testnet.ckb.dev")
if err != nil {
return
}
iterator, err := collector.NewLiveCellIteratorFromAddress(client, sender)
if err != nil {
return
}
// build transaction
builder, err := builder.NewDaoTransactionBuilder(network, iterator, depositOutPoint, client)
if err != nil {
return
}
builder.FeeRate = 1000
if err := builder.AddWithdrawOutput(sender); err != nil {
return
}
builder.AddChangeOutputByAddress(sender)
withdrawInfo, err := handler.NewWithdrawInfo(client, depositOutPoint)
if err != nil {
return
}
txWithGroups, err := builder.Build(withdrawInfo)
if err != nil {
return
}
// sign transaction
txSigner := signer.GetTransactionSignerInstance(network)
_, err = txSigner.SignTransactionByPrivateKeys(txWithGroups, "0x6c9ed03816e3111e49384b8d180174ad08e29feb1393ea1b51cef1c505d4e36a")
if err != nil {
return
}
// send transaction
hash, err := client.SendTransaction(context.Background(), txWithGroups.TxView)
if err != nil {
return
}
fmt.Println("transaction hash: " + hexutil.Encode(hash.Bytes()))
return
}
=== RUN Test_WithdrawDaoExample
--- FAIL: Test_WithdrawDaoExample (1.31s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1002ec730]
goroutine 6 [running]:
testing.tRunner.func1.2({0x100345c40, 0x100614e70})
/usr/local/go/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1392 +0x39f
panic({0x100345c40, 0x100614e70})
/usr/local/go/src/runtime/panic.go:838 +0x207
github.com/nervosnetwork/ckb-sdk-go/v2/collector/builder.NewDaoTransactionBuilder(0x100433740?, {0x100434fe8?, 0xc000076660}, 0xc000024990, {0x1004379d0, 0xc000010088})
/Users/xueyanli/GolandProjects/ckb-sdk-go/collector/builder/dao.go:38 +0xd0
github.com/nervosnetwork/ckb-sdk-go/v2/collector/example.Test_WithdrawDaoExample(0x0?)
/Users/xueyanli/GolandProjects/ckb-sdk-go/collector/example/example_test.go:321 +0x176
testing.tRunner(0xc000191a00, 0x1003d73a0)
/usr/local/go/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1486 +0x35f
Process finished with the exit code 1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels