Documentation
¶
Overview ¶
Package fundimport takes coin the user already owns into a wallet's pool: the outputs of a mined transaction, paid from the user's own wallet to the fund address a command printed, imported by txid. It is the funding path on mainnet and testnet, where nobody running a command has coinbase.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotMined = errors.New("not mined yet; import it once it has a block")
ErrNotMined is a transaction the node has not placed in a block yet.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// TxID is the transaction imported.
TxID string
// Added is how many outputs entered the pool, Satoshis their sum.
Added int
Satoshis uint64
// Paying is how many outputs pay the fund address; Spent how many of
// them the node shows spent already (left out); Held how many the pool
// already held (left out).
Paying int
Spent int
Held int
// Height is the block the transaction is mined in.
Height uint32
}
Result is what an import took.
func Import ¶
func Import(ctx context.Context, s *bwallet.Signer, pool *bwallet.Pool, asset *nodeapi.Asset, headers chaintracker.ChainTracker, txid string) (Result, error)
Import fetches txid and its proof from the node's asset API, checks the proof against the header source, and adds every output that pays the signer's fund address, that the node shows unspent and that the pool does not hold, with the transaction and its proof so a later spend can carry its parent. An output whose spend the node cannot vouch for is an error and nothing is added: a coin added on no evidence could be one already spent.