This repository has been archived by the owner. It is now read-only.

wallet has coins spent in incomplete transactions #2443

Closed
ericflo opened this Issue Oct 24, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@ericflo
Contributor

ericflo commented Oct 24, 2017

This error crops up quite often on Sia full nodes running in the SiaCDN cluster:

error when calling /wallet/siacoins: unable to fund transaction: wallet has coins spent in incomplete transactions - not enough remaining coins

I haven't yet pinpointed what sets of actions cause this to happen. For whatever reason, when it gets into this state, it tends to get stuck that way. My fix is to manually open a terminal session to the stuck nodes and use siac to send smaller transactions out manually.

Of note is that I'm using the following pseudocode. It could be that there's something I'm doing wrong here with SiacoinPrecision or something else, and it's just the error message that's leading me to think it's a Sia issue (which might ironically be a Sia issue—for the error message):

import "github.com/NebulousLabs/Sia/types"

const siaPerTB = 210.39

type SiaNode struct {
	Capacity float32 `json:"capacity"` // e.g. 5.0 for 5TB
	// ...
}

func (sn *SiaNode) DesiredCurrency() types.Currency {
	return types.SiacoinPrecision.MulFloat(float64(siaPerTB * sn.Capacity))
}

@lukechampine lukechampine added the Bug label Nov 13, 2017

@lukechampine

This comment has been minimized.

Member

lukechampine commented Nov 13, 2017

This error occurs when the wallet has coins "locked up" in unconfirmed transactions. i.e.:

  • wallet has a single output, worth 100SC
  • wallet sends 10SC to someone, resulting in a 90SC "change output" returned to the wallet
  • wallet immediately tries to use the change output to fund another 10SC transaction

Since the 90SC output is unconfirmed, the wallet refuses to spend it. Otherwise, you could end up with a "daisy chain" of outputs that spent other unconfirmed outputs, and if the original output doesn't actually make it onto the blockchain (for whatever reason), everything gets mucked up.

So if it's getting stuck for a block or two, that's understandable. If it's stuck permanently, there's definitely a bug. I don't know what your setup is, but if you're funding nodes by sending them a single large output, it may help to send multiple smaller outputs instead.

@tbenz9

This comment has been minimized.

Collaborator

tbenz9 commented Dec 21, 2017

I'm closing this due to inactivity and because Luke offered an excellent explanation and workaround. Please reopen this issue if you are still having issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.