nervosnetwork / ckb-sdk-go

MIT License
21 stars 23 forks source link

Invalid memory address or nil pointer dereference error occurs in dao withdrawal transaction #216

Open 15168316096 opened 1 year ago

15168316096 commented 1 year ago

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

=== 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

15168316096 commented 1 year ago

This is because the case uses the previously generated deposit cell, which should be combined with the case of deposit nevos dao to obtain a new deposit cell. Therefore, in order to ensure the stability of the case, this value cannot be hard-coded. The process of deposit nervos dao should be quoted first and then withdraw, same as java sdk