Commit Graph

23 Commits

Author SHA1 Message Date
Elle Mouton
432b1f0588 btcwallet: lock blockcache for Neutrino GetBlock
This commit ensures that for the neutrino implementation of
lnwallet.BlockChainIO, the neutrino GetBlock method is called directly
(since it already uses the blockcache). It also ensures that the block
cache mutex for the given hash is locked before the call to GetBlock.
2021-04-28 09:46:11 +02:00
Elle Mouton
106f93a1b4 btcwallet: make blockcache available to BtcWallet
This commit makes the blockcache available to BtcWallet so that any
GetBlock call made to BtcWallet is wrapped by the blockcache GetBlock
call.
2021-04-28 09:46:11 +02:00
Olaoluwa Osuntokun
5ecde6d552
lnwallet+chainntnfs: update to use latest neutrino APIs 2019-09-11 05:57:06 -07:00
Johan T. Halseth
6110182371
lnwallet/btcwallet: provide cancel chan as neutrino QuitChan option
This will make sure a long-running rescan can be canceled in case
Neutrino is the backend.
2019-05-09 14:44:52 +02:00
Johan T. Halseth
10070ecab7
lnwallet: make BlockChainIO.GetUTXO take cancel chan
Use quit channels as cancel chan for call to GetUTXO.
2019-05-09 14:44:47 +02:00
Olaoluwa Osuntokun
84c458cc9f
lnwallet/btcwallet: update neutrino GetUtxo impl to use new API 2018-07-31 21:28:57 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Olaoluwa Osuntokun
af4afdb6f0
lnwallet: use btcutil.NewAmount for BTC -> SAT conversions
In this commit, we fix an existing rounding related bug in the codebase.
The RPC interface for btcd and bitcoind return values in BTC rather than
in satoshis. So in several places, we're forced to convert ourselves
manually. The existing logic attempted to do this, but didn't properly
account for rounding. As a result, our values can be off due to not
rounding incorrectly.

The fix for this is easy: simply properly use btcutil.NewAmount
everywhere which does rounding properly.

Fixes #939.
2018-03-25 19:15:18 -07:00
Alex
187f59556a multi: add bitcoind drivers and tests 2018-01-15 13:59:34 -08:00
Conner Fromknecht
c17b695128
lnwallet/btcwallet/blockchain: properly handle nil spend report
This commit adds an additional check in GetUtxo that
tests for the nil-ness of the spend report returned by
the neutrino backend. Previously, a nil error and
spend report could be returned if the rescan did not
find the output at or above the start height. This
was observed to have cause a nil pointer dereference
when the returning line attempted to access the output.
This case is now handled by returning a distinct error
signaling that the output was not found.
2018-01-09 18:14:25 -08:00
Olaoluwa Osuntokun
91d4e6a377
lnwallet/btcwallet: fix duplicate imports 2017-06-05 19:41:12 -07:00
Olaoluwa Osuntokun
cbf7cd48f5
multi: update to latest neutrino API changes 2017-06-05 19:41:07 -07:00
Olaoluwa Osuntokun
0e8af209bd
lnwallet/btcwallet: update BlockChainIO implementation to be backend aware 2017-06-05 19:12:00 -07:00
Olaoluwa Osuntokun
a18d9b8449
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.
2017-05-11 15:20:29 -07:00
Andrey Samokhvalov
fd97a4bd19 lnd: partially fix golint warnings 2017-03-13 16:30:23 -07:00
Trevin Hofmann
40c7bac3aa multi: fix a variety of typos throughout the repo 2017-01-17 17:02:56 -08:00
Olaoluwa Osuntokun
5affed38fc
multi: update btcsuite API's to latest upstream changes
This commit makes a large number of minor changes concerning API usage
within the deamon to match the latest version on the upstream btcsuite
libraries.

The major changes are the switch from wire.ShaHash to chainhash.Hash,
and that wire.NewMsgTx() now takes a paramter indicating the version of
the transaction to be created.
2017-01-05 13:56:34 -08:00
Olaoluwa Osuntokun
473f298524
lnwallet/btcwallet: fix bug in GetUtxo for BlockChainIO implementation
This commit fixes an unnoticed bug within btcwallet’s implementation of
the BlockChainIO interface, specifically the GetUtxo method. In order
to maintain compatibility with Bitcoin Core’s gettxout method, btcd
doesn’t return an error if the targeted output is actually spent.

We weren’t properly detecting this, but we do now by creating a new
error which is returned in the case of a nil error but a nil return
value.
2016-12-27 16:44:27 -08:00
Olaoluwa Osuntokun
4a0a657eb0
lnwallet/btcwallet: fix bug in implementation of GetUxo
This commit fixes a bug within the btcwallet implementation of the
BlockChainIO interface. The exact nature of the bug was a rounding
error that would only manifest if the value of the UTXO was below 1
BTC.

The tests within this package currently test channels with mostly whole
values of BTC, as a result the bug went unnoticed until now.

The fix itself is trivial: convert to an int64 AFTER performing the
multiplication to convert to satoshis from Bitcoin.
2016-12-27 16:43:51 -08:00
Olaoluwa Osuntokun
b49d2827a2
lnwallet/btcwallet: add compile-time interface assertions for Signer+BlockChainIO 2016-12-27 16:43:31 -08:00
Olaoluwa Osuntokun
782fc61dc1
lnwallet+lnrpc: convert GetCurrentHeight to GetBestBlock in BlockChainIO
This commit expands the data returned by the current GetCurrentHeight
to also return the current best block hash, expanding the method into
GetBestBlock. Additionally, the current best BlockHash is also now
displayed within the GetInfo RPC call.
2016-12-27 16:43:26 -08:00
Andrey Samokhvalov
1119d75996
lnwallet: add additional BlockChainIO methods 2016-12-27 16:43:05 -08:00
Olaoluwa Osuntokun
6a1d8d0682
lnwallet: add a BtcWallet implementation of WalletController
This commit adds the first concrete implementation of the
WalletController interface: BtcWallet. This implementation is simply a
series of wrapper functions are the base btcwallet struct.

Additionally, for ease of use both the BlockChain IO and Signer
interface are also implemented by BtcWallet. Finally a new WalletDriver
implementation has been implemented, and will be register by the init()
method within this new package.
2016-09-08 12:25:32 -07:00