Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dead OutPoint encountered when sending transaction #20

Closed
lostpg opened this issue May 13, 2020 · 2 comments
Closed

Dead OutPoint encountered when sending transaction #20

lostpg opened this issue May 13, 2020 · 2 comments

Comments

@lostpg
Copy link

lostpg commented May 13, 2020

I am deploying a contract on the dev chain using the go sdk, with Go code here.

But when I was trying to raise a transaction, it failed with a log

2020/05/13 17:52:03 send transaction error: OutPoint: Dead(OutPoint(0x120803ff0f9891c2278f26d605f4e67e1b462a1a3ebbf0444ed17e74198920f000000000))
exit status 1

Maybe I made this error by using CellCollector wrongly. How can I get all live cells correctly?

@lostpg
Copy link
Author

lostpg commented May 13, 2020

It seems that this problem is caused by code here.

The JSON rpc get_cells_by_lock_hash returns live cells in block range [from, to], which means the cells in the block at height to are counted in.

While the code below will count in some cells twice as the for loop goes.

func (c *CellCollector) collectFromBlocks(lockHash types.Hash) (*CollectResult, error) {
        // omitted snippets 
	for {
		end := start + 100
                // omitted snippets 
		start += 100
	}
	return &result, nil
}

As for the solution, a slight change may work.

start += 100 // -> start += 101

@ququzone
Copy link
Owner

@lostpg thanks, v0.2.2 already fixed this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants