lnwallet+routing: modify BlockChainIO.GetUtxo to be light client friendly

This commit modifies the GetUtxo method of the BlockChainIO interface
to be more light client friendly by introducing a height hint which
gives light clients that don’t have UTXO set commitments a way in which
they can restrict their search space. Light clients will now be able to
have a concrete cut off point in the chain as they scan backwards for
spentness of an output.
This commit is contained in:
Olaoluwa Osuntokun
2017-05-10 16:37:14 -07:00
parent 333373f78f
commit a18d9b8449
3 changed files with 10 additions and 7 deletions

View File

@@ -209,9 +209,12 @@ type BlockChainIO interface {
// most-work chain the implementation is aware of.
GetBestBlock() (*chainhash.Hash, int32, error)
// GetTxOut returns the original output referenced by the passed
// outpoint.
GetUtxo(txid *chainhash.Hash, index uint32) (*wire.TxOut, error)
// GetUtxo attempts to return the passed outpoint if it's still a
// member of the utxo set. The passed height hint should be the "birth
// height" of the passed outpoint. In the case that the output is in
// the UTXO set, then the output corresponding to that output is
// returned. Otherwise, a non-nil error will be returned.
GetUtxo(op *wire.OutPoint, heightHint uint32) (*wire.TxOut, error)
// GetTransaction returns the full transaction identified by the passed
// transaction ID.