Commit Graph

81 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
b1503adfad
lnwallet: add new PreimageCache interface 2018-01-22 19:19:29 -08:00
Alex
187f59556a multi: add bitcoind drivers and tests 2018-01-15 13:59:34 -08:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Micah Lerner
6ae7d275ab lnwallet: Add destination addresses to listchaintxns 2017-12-08 15:11:23 -08:00
Olaoluwa Osuntokun
4a277276fd
lnwallet: update SendOutputs method on WalletController to accept fee
In this commit, we extend the existing SendOutputs method on the
WalletController interface to be able to accept a custom fee. With
this, users are now able to specify their exact fee, allowing the
wallet to be fee estimation agnostic.
2017-11-23 23:10:04 -06:00
Olaoluwa Osuntokun
6ef2770e57 lnwallet: move FeeEstimator into distinct file
In this commit, we move the FeeEstimator interface into a distinct file
as follow up commits will begin to flesh out the interface with
additional implementations.
2017-11-23 22:58:54 -06:00
Jim Posen
c94130328a lnwallet: Extend Utxo struct with AddressType.
The Utxo struct now includes the address type and redeem/witness
scripts. This is necessary for accurate fee estimation.
2017-10-19 17:37:53 -07:00
Conner Fromknecht
438c6b9621 lnwallet: move latest SignDescriptor + serialization 2017-08-25 17:56:50 -07:00
Philip Hayes
d8c56433e3 lnwallet: extract SignDescriptor serialization and witness generator 2017-08-25 17:56:50 -07:00
Olaoluwa Osuntokun
9c0261206d
lnwallet: modify the Signer interface to reflect new key derivation scheme
This commit modifies the Signer interface to reflect the new key
derivation defined within BOLT-0003. This entails removing the prior
PrivateTweak field all together in favor of two new fields: SingleTweak
and DoubleTweak.

These two fields are mutually exclusive. The SingleTweak field is now
required in order to sign all regular non-delay, and also must be used
to generate signatures for the localKey, or delayKey. The DoubleTweak
field is used to generate the private key that corresponds to the
revoked revocation key.
2017-07-30 17:49:31 -07:00
Olaoluwa Osuntokun
7d62293d4a
lnwallet: remove GetTransaction method from BlockChainIO 2017-06-05 19:12:42 -07:00
bryanvu
abe2e502d5 lnwallet: add FeeEstimator interface, StaticFeeEstimator implementation
This commit adds the FeeEstimator interface, which can be used for
future fee calculation implementations. Currently, there is only the
StaticFeeEstimator implementation, which returns the same fee rate for
any transaction.
2017-05-15 20:26:11 -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
Olaoluwa Osuntokun
b226edf96e
lnwallet: introduce the MessageSigner interface
This commit introduces the MessageSigner interface which is an abstract
object capable of signing arbitrary messages with a target public key.
This interface will be used within the daemon for: signing channel
authentication proofs, signing node/channel announcements, and also to
possibly sign arbitrary messages in the future.
2017-04-14 10:59:19 -07:00
Andrey Samokhvalov
fd97a4bd19 lnd: partially fix golint warnings 2017-03-13 16:30:23 -07:00
Olaoluwa Osuntokun
1da054625b
lnwallet/btcwallet: fix bug in non-recognition of self-funds in chan force close
This commit fixes a bug which would cause the node on the _receiving_
side of a channel force close to be blind of their immediately funds
on-chain. The root of the issue was that within the btcwallet
implementation of the WalletController method ‘NewRawKey’, the wallet
wouldn’t request notifications for the new address, as the direct
function from the waddrmgr was used which skips registration of the new
address.

To fix, this, we now ensure that btcwallet will receive notifications
for keys used within the raw p2wkh commitment output. This ensures that
the wallet is aware of funds that are made available as a result of a
channel force closure by the channel counter party.
2017-02-07 20:01:19 -08: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
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
85defc3ec3
lnwallet: add new method IsSynced to the WalletController interface
This commit adds a new method to the WalletController interface:
IsSynced. The role of the function is to query the local wallet about
if it thinks it has fully synced to the tip of the current main chain.
This function can be useful within U.I’s to block off certain
functionality until the wallet is fully synced to the main chain.
2016-12-12 15:56:33 -08:00
Olaoluwa Osuntokun
e942e70651
lnwallet: extend the SignDescriptor to include a PrivateTweak
This commit extends the SignDescriptor with a single attribute, the
‘PrivateTweak’. The duties of the Signer interface have also been
augmented to properly derive a private key using the specified tweak,
iff it’s non-nil.

As currently defined in order to generate the proper private key based
off of a PrivateTweak, the signer is to add the tweak value to the
private key for the specified public key. This generated value is to be
used for signing within the specified context.

This change paves the way for automatic revoked output sweeping with
signatures generated directly by the Signer interface, maintaining the
structure of the abstraction.

A test has been added at the interface level in order to excerise each
WalletController’s implementation of the key derivation as currently
defined.
2016-11-18 17:12:58 -08:00
andrew.shvv
e515710a7d multi: use witnessScript everywhere instead of redeemScript
This commit consists of a mass variable renaming to call the pkScript being executed for segwit outputs the `witnessScript` instead of `redeemScript`. The latter naming convention is generally considered to be reserved for the context of BIP 16 execution. With segwit to be deployed soon, we should be using the correct terminology uniformly through the codebase. 

In addition some minor typos throughout the codebase has been fixed.
2016-10-15 16:02:09 -07:00
Olaoluwa Osuntokun
2eb1936cce
lnwallet: extend the WalletController with a new txn pub/sub client
This commit adds a new simple interface related to the WalletController
which allows for subscribing to new notifications as transactions
relevant to the wallet are seen on at the network and/or mined. The
TransactionSubscription interface will prove useful for building higher
level UI’s on-top of the daemon which update the presentation layer in
response to received notifications.
2016-10-15 14:07:24 -07:00
Olaoluwa Osuntokun
78cfcc28b7
lnwallet: add method to list relevant txns to WalletController interface 2016-10-14 20:14:15 -07:00
Olaoluwa Osuntokun
d0353b2864
lnwallet: add ability to trigger a force closure within channel state machine
This commit introduces the concept of a manually initiated “force”
closer within the channel state machine. A force closure is a closure
initiated by a  local subsystem which broadcasts the current commitment
state directly on-chain rather than attempting to cooperatively
negotiate a closure with the remote party.

A force closure returns a ForceCloseSummary which includes all the
details required for claiming all rightfully owned outputs within the
broadcast commitment transaction.

Additionally two new publicly exported channels are introduced, one
which is closed due a locally initiated force closure, and the other
which is closed once we detect that the remote party has executed a
unilateral closure by broadcasting their version of the commitment
transaction.
2016-09-12 19:07:35 -07:00
Olaoluwa Osuntokun
5449ba2b34
lnwallet: revamp interfaces, add BlockChainIO and Singer
This commit revamps the previous WalletController interface, edging it
closer to a more complete version.

Additionally, this commit also introduces two new interfaces:
BlockchainIO, and Singer along with a new factor driver struct, the
WalletDriver.

This BlockChainIO abstracts read-only access to the blockchain, while
the Singer interface abstracts the signing of inputs from the base
wallet paving the way to hardware wallets, air-gapped signing, etc.

Finally, in order to provide an easy method for selecting a particular
concrete implementation of a WalletController interface, the concept of
registering “WalletDriver”s has been introduced. A wallet driver is
essentially the encapsulation of a factory function capable of create a
new instance of a Wallet Controller.
2016-09-08 12:25:28 -07:00
Olaoluwa Osuntokun
8bbd010f74
lnwallet: use the ChainNotifier interface throughout instead of BtcdNotifier
This commit refactors the code within lnwallet interacting with the
ChainNotifier to accept, and call against the implementation rather
than a single concrete implementation.

LightningWallet no longer creates it’s own BtcdNotifier implementation
doing construction, now instead accepting a pre-started `ChainNotifier`
interface.  All imports have been updated to reflect the new naming
scheme.
2016-09-01 19:13:19 -07:00
Olaoluwa Osuntokun
fcff17c336
multi: change all imports to roasbeef's forks
This commit will allow the general public to build lnd without jumping
through hoops setting up their local git branches nicely with all of
our forks.
2016-05-15 17:22:37 +03:00
Olaoluwa Osuntokun
f9a8dcbc9c lnwallet: add ListUnspentWitness to WalletController
This method has been added in order to allow lnd to collect eligible
unspent witness programs outputs from the wallet controller for use as
inputs to the funding transaction.

Additionally, the change address functions now also specify whether the
generated change address should be payable to a witness program or not.
2016-04-12 21:36:41 -07:00
Olaoluwa Osuntokun
10d52611cd lnwallet: introduce WalletController interface as a "base wallet"
The WalletController will serve as a layer of separation between “base”
Bitcoin wallet logic, and the higher level Lightning Network logic. As
a result LightningWallet will no behave as an overly wallet, relying on
the lower wallet for basic services such as new address, signing etc.

Within this higher level lies the awareness of channel types, chain
monitoring, HTLCs, and so on.
2016-03-24 16:19:57 -07:00