Commit Graph

305 Commits

Author SHA1 Message Date
practicalswift
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -07:00
Olaoluwa Osuntokun
7a13378671
channeldb+contractcourt: add additional logging around co-op channel closes 2018-04-12 17:13:37 -07:00
Conner Fromknecht
f594a242ea
channeldb/channel_test: test ShortChanID is updated in-mem
Modifies TestFetchPendingChannels to verify that calls to
MarkAsOpen also modify the in-memory state. Previously we
only tested the persistent state loaded immediately after.
2018-03-27 17:07:15 -07:00
Conner Fromknecht
9fd73af589
channeldb: update chanid in-mem during MarkAsOpen
Modifies the MarkAsOpen operation to also update the
ShortChanID and IsPending fields in-memory. Before,
only the on-disk representation was updated, which
may have lead to stale data channel states being
passed in-memory.
2018-03-27 17:05:22 -07:00
Conner Fromknecht
5df8b52dae
multi: set initiator funding txn 2018-03-11 15:06:22 -07:00
Conner Fromknecht
db88c82169
channeldb/channel: add serialization for single funder funding txn 2018-03-11 13:58:40 -07:00
Olaoluwa Osuntokun
800eea931f
build+multi: switch from bolt to bbolt
In this commit, we switch from boltbd/bolt to coreos/bbolt as the
former is no longer being actively maintained.
2018-03-10 19:01:13 -08:00
Conner Fromknecht
7a93c7530c
channeldb/invoices: add idempotency to SettleInvoice 2018-03-09 14:45:30 -08:00
Conner Fromknecht
e4d2958f68
channeldb/channel_test: init with Pacakager and construct FwdPkgs 2018-03-09 14:45:30 -08:00
Conner Fromknecht
2df9fb5510
channeldb/channel: adds fwding package to channeldb 2018-03-09 14:45:30 -08:00
Conner Fromknecht
d18c317220
channeldb/forwarding_package_test: test PkgFilter 2018-03-09 14:45:29 -08:00
Conner Fromknecht
41c40a9560
channeldb/forwarding_package: initial fwdpkg 2018-03-09 14:45:29 -08:00
Olaoluwa Osuntokun
705661a39e
channeldb: replace raw keys in ChannelConfig with keychain.KeyDescriptor
In this commit, we remove references to raw keys from the main
ChannelConfig struct and instead replace it with usage of
keychain.KeyDescriptor. We do this, as the ChannelConfig as it stands
is a near complete static description of a channel. In the future, it
will be possible to export these static descriptions as backups. We
prefer the KeyDescriptor of a plain PublicKey, as the KeyLocator
portion of the struct allows a stateless signer to re-derive the keys
as needed when signing.
2018-03-06 16:04:01 -05:00
Olaoluwa Osuntokun
744cfd2ce5
channeldb: add a set of initial tests for the ForwardingLog 2018-03-06 13:56:09 -05:00
Olaoluwa Osuntokun
f2cd668bcf
channeldb: add new ForwardingLog storage namespace
In this commit, we add a new storage namespace to channeldb: the
ForwardingLog. This log will be used by higher level sub-systems to log
each successfully completed HTLC. Each payment circuit will be
summarized as a “ForwardingEvent”. A series of events can then be
queried via a time slice query. In a time slice query, the caller
specifies a time range, a number of events to skip, and the max number
of events to return. Each query will return the index of the final
item. As we have a max number of events we’ll return in a response,
callers may need to use this last offset index to seek further by
skipping that number of entries. Combining these fields, callers are
able to query the time series, skipping an arbitrary amount of events,
and capping the max number of returned events.
2018-03-06 13:56:06 -05:00
Johan T. Halseth
004563b20b
channeldb: add todo making feerate explicit type 2018-02-26 22:42:27 +01:00
practicalswift
b8e1351cf3 multi: fix some recently introduced typos 2018-02-18 15:27:29 -08:00
Olaoluwa Osuntokun
3e422fedd3
channeldb: further GC optimizations during path finding
In this commit, we made a series of modification to the way we handle
reading edges and vertexes from disk, in order to reduce the amount of
garbage generated:
  1. Properly use PubKeyBytes are required rather than PubKey()
  2. Return direct structs rather than pointers, and leave it to the
runtime to perform escape analysis.
  3. In-line the former readSig() method when reading sigs from disk.
2018-02-12 16:17:14 -08:00
Johan T. Halseth
65723387fa
channeldb: update ChannelConstraints godoc
This commit changes the definition of the
constraints in the ChannelConstraints struct
to specify that these are all constraints the
*owner* of the set of constraints must *never
violate*.

This is done to make it easier to check that
a particular node is not violating any
constraint for a gien update, as before it
could violate constraints found both in its
local and the remote contraints.
2018-02-08 18:35:24 -05:00
Olaoluwa Osuntokun
e578cea375
channeldb: fix linter errors 2018-02-06 20:14:34 -08:00
Olaoluwa Osuntokun
5e9166e478
channeldb: use raw pub keys and signatures directly in vertex/edge structs
In this commit, we make an API change that’s meant to reduce the amount
of garbage we generate when doing pathfinding or syncing nodes with our
latest graph state. Before this commit, we would always have to fully
decode the public key and signatures when reading a edge or vertex
struct. For the edges, we may need several EC operations to fully
decode all the pubkeys. This has been seen to generate a ton of
garbage, as well as slow down path finding a good bit.

To remedy this, we’ll now only ever read the *raw* bytes from disk. In
the event that we actually need to verify a signature (or w/e), only
*then* will we fully decode everything.
2018-02-06 20:14:31 -08:00
Daniel McNally
8543497dcc multi: fixing it's/its typos in comments 2018-02-06 19:13:07 -08:00
practicalswift
a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
MeshCollider
4b1cc98808 multi: apply roasbeef diff to support incoming socks.ProxiedAddr 2018-02-05 17:37:46 -08:00
MeshCollider
36219427ad channeldb: use string comparison instead of deepequal to avoid array length mismatches 2018-02-05 17:37:46 -08:00
MeshCollider
d8f453d9dc channeldb: remove address resolution from channeldb 2018-02-05 17:37:46 -08:00
nsa
e2142c778f multi: Added Tor support
This commit adds Tor support. Users can set the --TorSocks flag
to specify which port Tor's SOCKS5 proxy is listening on so that
lnd can connect to it. When this flag is set, ALL traffic gets
routed over Tor including DNS traffic. Special functions for
DNS lookups were added, and since Tor doesn't natively support
SRV requests, the proxySRV function routes connects us to
a DNS server via Tor and SRV requests can be issued directly
to the DNS server.

Co-authored-by: MeshCollider <dobsonsa68@gmail.com>
2018-02-05 17:37:46 -08:00
Olaoluwa Osuntokun
a94648e9dc
channeldb: properly use a read-transaction in FetchChannelEdgesByOutpoint
Before this commit, we’d unnecessarily use a write transaction within
the FetchChannelEdgesByOutpoint. This is wasteful as the function only
actually reads items from the database, and doesn’t attempt any
mutations at all.
2018-01-28 14:48:57 -08:00
Andrew Naoum
0f161c5033 channeldb+lnrpc: store the payment pre-image not rhash
Fixes #481.

Prior to this commit, payments stored in the channel DB only kept a
record of the payment hash. This is a problem as the preimage is what
serves as proof of payment and a user should be able to look up this
value in the future (not just immediately after payment).

Instead of storing both the payment hash and the preimage, we store the
preimage only since the hash can be derrived from this using a SHA256.

In the RPC listpayments command, we now give the preimage in addition to
the payment hash.
2018-01-27 18:36:33 -08:00
Conner Fromknecht
926949ef0f
channeldb/db: adds FetchClosedChannel
This commit adds a FetchClosedChannel method to the
channeldb, which allows querying based on a known
channel point. This will be used in the nursery to
load channel close summaries, which can be used to
provide more accurate height hints when recovering
from failures.
2018-01-24 15:38:50 -08:00
Olaoluwa Osuntokun
ebb4c84b32
channeldb: add new LatestCommitments and RemoteRevocationStore methods
These methods will allow the chainWatcher to ensure it has the latest
channel state before attempting to construct any resolution objects.
2018-01-22 19:19:51 -08:00
Olaoluwa Osuntokun
850ff1d970
channeldb: add new WitnessCache structure
In this commit, we add the WitnessCache sub-storage system of the
greater database. The WitnessCache is a persistent cache of all
witnesses we’ve encountered on the network. We’ll use this cache to
share any on-chain discoveries between active channels. Eventually
we’ll also use this to enforce the variant that a preimage is only to
be used ONCE on the network.
2018-01-22 19:19:37 -08:00
Olaoluwa Osuntokun
b4fc34a93a
channeldb: add ShortChanID to close channel summary 2018-01-22 19:19:35 -08:00
Olaoluwa Osuntokun
5d7119fe9c
channeldb: expose methods to serialize HTLC's on-disk
These new methods will be used by the contract court package to
properly serialize the state of HTLC’s that have yet to be fully
resolved on-chain.
2018-01-22 19:19:35 -08:00
Conner Fromknecht
95b788e9a6
channeldb/db: exposes Path method, useful for testing 2018-01-05 13:47:17 -08:00
Conner Fromknecht
1d69526874
channeldb/channel: adds IsBorked to OpenChannel 2018-01-05 13:47:17 -08:00
Matt Drollette
adf0d98194 multi: fix several typos in godoc comments 2017-12-17 18:40:05 -08:00
Johan T. Halseth
48e22219c0 channeldb: add ChannelFlags to OpenChannel struct
This commit adds the ChannelFlags field, of type
lnwire.FundingFlags, to the OpenChannel struct,
including serialization for database storage.
This is done to preserve the flags that were
sent during channel opening, currently used
to determine whether a channel should be made
public or not after opening.
2017-12-17 18:35:34 -08:00
Micah Lerner
cf6f313cff channeldb: update channeldb to set and store SettleDate for invoices 2017-12-08 16:50:04 -08:00
Micah Lerner
1295bfe096 channeldb: fix channel_test scoping error 2017-12-03 16:34:52 -08:00
Olaoluwa Osuntokun
9b53d7bd95
channeldb: treat Flags field in ChannelEdgePolicy as a bitfield 2017-11-30 22:41:54 -08:00
Olaoluwa Osuntokun
12e5951434
channeldb: extend ChannelConfig with new HtlcBasePoint key 2017-11-16 20:00:01 -08:00
Olaoluwa Osuntokun
6f51b941df
multi: fix linter errors 2017-11-10 19:51:13 -08:00
Olaoluwa Osuntokun
1fb05e0436
channeldb: properly craft key for reading/writing channel commitments
In this commit, we fix an existing bug that arose due to incorrectly
crafting the key we use to store channel commitments. Before this
commit, we tried to copy to a slice that hadn’t been allocated yet. As
a result, the key would only have the 0x00 or 0x01 as its value. We fix
this by properly crafting the key using the built-in append function.
2017-11-10 19:51:12 -08:00
Olaoluwa Osuntokun
699e5327e1
channeldb: don't delete the chainHash bucket in CloseChannel
In this commit, we fix an existing bug wherein if we closed two
channels, then we were unable to read the channel state afterwards as
we deleted the enclosing bucket.
2017-11-10 19:51:12 -08:00
Olaoluwa Osuntokun
3875754e0f
channeldb: also update chanInfo when updating commitment
In this commit, we fix an existing bug wherein we failed to update the
channels state once we accepted a new commitment. As a result, after a
state transition, if the channel state was read from disk, values like
TotalMSatSent wouldn’t be properly updated.
2017-11-10 19:51:11 -08:00
Olaoluwa Osuntokun
1d6e5ad1ef
channeldb: add missing mutex interaction to new methods 2017-11-10 19:51:11 -08:00
Olaoluwa Osuntokun
29f2f88abc
channeldb: expand TestChannelStateTransition to expertise new state transition related methods
In this commit we’ve extended the TestChannelStateTransition method to
exercise the new state transition related messages. This includes
ensuring that when we add a new dangling commitment, and then the
remote party revokes it, then the on-disk state is update accordingly.
2017-11-10 19:50:50 -08:00
Olaoluwa Osuntokun
06e6649da5
channeldb: update channel closing methods to respect new on-disk structure 2017-11-10 19:50:50 -08:00
Olaoluwa Osuntokun
385818307b
channeldb: update FetchOpenChannel to traverse new chain bucket 2017-11-10 19:50:49 -08:00
Olaoluwa Osuntokun
da7a5f7c4e
channeldb: update tests to respect new API's 2017-11-10 19:50:49 -08:00
Olaoluwa Osuntokun
0178920cba
channeldb: update CloseChannel to adhere to new disk structure
In this commit, we update the CloseChannel method to respect the new
on-disk bucket based structure. Additionally, we now ensure that we
delete the new chainBucket.
2017-11-10 19:50:48 -08:00
Olaoluwa Osuntokun
3cf4ac8237
channeldb: add a new ChainHash field to ChannelCloseSummary 2017-11-10 19:50:48 -08:00
Olaoluwa Osuntokun
da22078995
channeldb: modify FindPreviousState to return a ChannelCommitment 2017-11-10 19:50:47 -08:00
Olaoluwa Osuntokun
5bdff9585b
channeldb: modify RevocationLogTail to return a ChannelCommitment 2017-11-10 19:50:47 -08:00
Olaoluwa Osuntokun
374cab7467
channeldb: rename AppendToRevocationLog to AdvanceCommitChainTail
In this commit, in addition to the renaming we’ve modified the behavior
of AdvanceCommitChainTail as follows: this method now will simply
atomically advance the commitment tail, set the new commitment to the
prior dangling commitment, and update the on-disk revocation log.

The macho expects the new revocation state to already be stored within
the channel. This method is to be called once the remote party revokes
their current commitment state.
2017-11-10 19:50:47 -08:00
Olaoluwa Osuntokun
b89c14616c
channeldb: add new RemoteCommitChainTip method
In this commit, we add a new method: RemoteCommitChainTip. This method
allows callers to poll the database state to check if we have an
un-acked commitment for the remote party. If so, then it should be
retransmitted once a communication channel has been re-established with
the channel peer. This method will return ErrNoPendingCommit if we
don’t currently have a dangling commitment.
2017-11-10 19:50:46 -08:00
Olaoluwa Osuntokun
893cda3ac2
channeldb: add new AppendRemoteCommitChain method
In this commit, we add a new method AppendRemoteCommitChain. This
method is meant to be used once we extend a new state to the remote
party, but before we actually transmit the CommitSig message. With this
method, we store a fully valid CommitDiff on disk which can be used in
the case that we need to retransmit the state to the party as they
didn’t fully receive it.
2017-11-10 19:50:46 -08:00
Olaoluwa Osuntokun
10a54a45fd
channeldb: expand the CommitDiff struct with the addition of LogUpdate
In this commit we finalized the structure of the CommitDiff struct by
adding a set of LogUpdates, and also a valid CommitSig message.

The LogUpdate struct houses a messages that were transmitted and
locked-in with the new commitment state. We include the LogIndex along
with the wire messages itself in order to be able to properly
reconstruct the update log upon restart.

The CommitSig message included should be transmitted after the set of
LogUpdates, and fully covers the new commitment state and any new (or
already present) HTLC’s that were included as part of the state.
2017-11-10 19:50:45 -08:00
Olaoluwa Osuntokun
3e3969eb66
channeldb: modify UpdateCommitment to accept a ChannelCommitment
In this commit, we modify the UpdateCommitment method to accept a full
ChannelCommitment rather than a new transaction, the sig, and a
ChannelDelta. This new structure of this method also takes advantage of
the new bucket structure of the storage schema. Additionally, this
method will now atomically swap in the new passed commitment to point
to the LocalCommitment value within the struct.
2017-11-10 19:50:45 -08:00
Olaoluwa Osuntokun
2dcd82e779
channeldb: add new MarkAsOpen method to OpenChannel struct
In this commit we add a new MarkAsOpen method to the OpenChannel
struct. This method replaces the existing MarkChannelAsOpen method
which targeted the database struct itself.
2017-11-10 19:50:44 -08:00
Olaoluwa Osuntokun
4ae0b008ed
channeldb: modify storage of OpenChannel struct to use new codec.go
In this commit we comptely overhaul the existing storage of the
OpenChannel struct to use the new common serialization defined within
the codec.go file. Additionally, we’ve modified the structure of the
channel database on disk. Rather then use the existing prefix based
segmentation, everything is now bucket based. This has resulted in much
simpler and easier to follow code. The bucket progression is:
openChannelBucket -> nodeBucket -> chainBucket -> channelBucket. We add
a chainBucket as it’s possible that in the future we may have several
channels on distinct chains with a given node.

With the above changes, we’re able to delete much of the existing code
within the file, drastically reducing its size.
2017-11-10 19:50:44 -08:00
Olaoluwa Osuntokun
040c6bdf22
channeldb: add new HtlcIndex and LogIndex fields to the HTLC struct
By adding these two fields, it is now possible to fully reconstruct the
channel’s update log from the set of HTLC’s stored on disk, as we now
properly note both the log index and HTLC index. Prior to this commit
we would simply start the new log index based on the amount of HTLC’s
that were present in the prior state.
2017-11-10 19:50:43 -08:00
Olaoluwa Osuntokun
fb8ff256d8
channeldb: restructure the OpenChannel struct to use two ChannelCommitments
In this commit, we restructure the OpenChannel struct to used two
distinct ChannelCommitments: one for the remote party, and one for the
local party. With this, we now partition the local state and the remote
state. Previously, we weren’t properly tracking the state of the remote
party. As a result, there were certain classes of failures we were
unable to properly recover from. With this separation, we can now
handle them, and the OpenChannel struct is slimmer and more
understandable.
2017-11-10 19:50:43 -08:00
Olaoluwa Osuntokun
4bc317fbbe
channeldb: add new ChannelCommitment struct
In this commit we’ve added a new struct to the package:
ChannelCommitment. This sturct houses all the common data the comprises
a particular commitment state. This will soon replace the open fielded
commitmetn fields within the OpenChannel struct.
2017-11-10 19:50:35 -08:00
Olaoluwa Osuntokun
e3cdbcac0c
channeldb: add new codec.go file which houses common serialization funcs
In this commit, we add a new files to the channeldb package: codec.go.
This file is similar to the way that serialization is done within the
lnwire package. The goal of this file is to reduce all the duplication
within the common serialization methods across the package.
2017-11-09 19:44:37 -08:00
Andrey Samokhvalov
9247168c5d not finished index persistence 2017-11-09 16:38:58 -08:00
Andrey Samokhvalov
28dd6e5d84 channeldb+lnwallet: add remote pending commiment persistance 2017-11-09 16:38:58 -08:00
Andrey Samokhvalov
7aa7cb1caf channeldb: add persistance of the onion blob
In this commit htlc channeldb representation have been augmented
with onion blob field, and (de)serialisaion functions have been changed
to make the onion blob persistant.
2017-11-09 16:38:58 -08:00
Johan T. Halseth
b26560e0f4
channeldb: add DisconnectBlockAtHeight
This commit adds the method DisconnectBlockAtHeight to the channel
graph database, making it possible to "rewind" the database in case
a block is disconnected from the main chain. To accomplish this,
a prune log is introduced, making it possible to keep track of the
point in time where the database was pruned. This is necessary for
the case where lnd might wake up on a stale branch, and must "walk
backwards" on this branch after it finds a common block fro the
graph database and the new main chain.
2017-11-03 00:05:19 +01:00
Jim Posen
a13ad0a339 multi: Fix various typos. 2017-10-25 13:20:54 -07:00
Jim Posen
9fd77a6e40 multi: Update lnd to use new feature vector API. 2017-10-17 22:47:20 -07:00
Olaoluwa Osuntokun
5eb3406b19
channeldb: add new Database method to ChannelGraph 2017-10-10 22:19:26 -07:00
Olaoluwa Osuntokun
81cd954cfc
discovery: don't prune *our* channels during retransmission tick
This commit modifies the recently modified logic for self-channel
retransmission to exclude pruning *our* channels which haven’t been
updated since the broadcastInterval. Instead, we only re-broadcast
channels of ours that haven’t been updated in 24 hours.
2017-10-04 20:46:08 -07:00
Laura Cressman
6253419ce5 channeldb: use binary.Read/Write in waitingproof.go
Use binary.Read/Write when reading and writing booleans
in Encode and Decode functions that operate on the
WaitingProof struct.
2017-10-02 23:13:47 -07:00
Laura Cressman
3f6a58f967 channeldb: use binary.Read/Write in invoices.go
Use binary.Read/Write in when reading and writing
booleans in functions to serialize and deserialize
invoices.
2017-10-02 23:13:47 -07:00
Laura Cressman
156772d04a channeldb: use binary.Read/Write with bools in channel.go
Use binary.Read/Write in functions to serialize and deserialize
channel close summary and HTLC boolean data, as well as in
methods to put and fetch channel funding info. Remove lnd
implementations of readBool and writeBool as they are no
longer needed. Also fix a few minor typos.
2017-10-02 23:13:47 -07:00
Johan T. Halseth
5ed31b1030
channeldb: store payment request with invoices 2017-09-27 12:26:04 +02:00
Olaoluwa Osuntokun
5ff82c92da
channeldb: add commitment transaction fee to ChannelSnapshot 2017-09-24 20:09:28 -07:00
halseth
8693e8babc channeldb: check chanIndex bucket for nilness instead of edges 2017-09-19 05:40:29 +02:00
Dave Collins
916ab454c1 channeldb: Fix payment serialization tests.
This modifies the tests that deal serializing the Invoice type to limit
the creation date to seconds since Go1.9 added the concept of a
monotonic component to times which does not round trip through
MarshalBinary and UnmarshalBinary and therefore causes the tests to fail.

In particular, it modifies the creation dates in the randInvoice,
makeFakePayment, makeRandomFakePayment, and TestInvoiceWorkflow
functions.

This results in allowing TestOutgoingPaymentSerialization,
TestOutgoingPaymentWorkflow, and TestInvoiceWorkflow to pass.
2017-08-30 18:57:39 -07:00
Conner Fromknecht
6ffe33f01a lnw+ba+utxon+cdb: reverts OutPoint and TxOut encoding 2017-08-25 17:56:50 -07:00
Conner Fromknecht
4cdce1fc0a breacharbiter+channeldb: resolves rebase conflicts 2017-08-25 17:56:50 -07:00
Philip Hayes
f0aa186a56 channeldb+utxonursery+lnwire: use lnwire's OutPoint,TxOut serialization 2017-08-25 17:56:50 -07:00
Olaoluwa Osuntokun
460c2b0ec1
channeldb: update test to match recent API changes 2017-08-22 00:52:28 -07:00
Olaoluwa Osuntokun
76302a136b
channeldb: in node.ForEachChannel return incoming/outgoing edges
This commit modifies the node.ForEachChannel to *also* return the
incoming edge as well as the outgoing edge. We make this modification
as when we’re doing path finding, we need to return the incoming edge
as well, since we need to use the to properly compute the time lock and
fees for transit on that edge.
2017-08-22 00:52:25 -07:00
Olaoluwa Osuntokun
35d9dc8092
channeldb: add ChainHash to ChannelEdgeInfo to match BOLT-0007 2017-08-22 00:52:22 -07:00
Olaoluwa Osuntokun
59aae249dc
channeldb: use lnwire.MilliSatoshi within the ChannelEdgePolicy struct 2017-08-22 00:52:20 -07:00
Olaoluwa Osuntokun
74470cf7d0
channeldb: update ChannelConstraints+OpenChannel to use lnwire.MilliSatoshi 2017-08-22 00:52:17 -07:00
Olaoluwa Osuntokun
251f8d650f
channeldb: update the Invoice struct to use lnwire.MilliSatoshi 2017-08-22 00:52:15 -07:00
Olaoluwa Osuntokun
063525c6e0
channeldb: update the OutgoingPayment struct to use lnwire.MilliSatoshi 2017-08-22 00:52:12 -07:00
Olaoluwa Osuntokun
8abba7eafc
channeldb: add TODO to add storage for onion adds 2017-08-10 21:15:55 -07:00
Johan T. Halseth
849d0b93b1 fundingManager: persist state in opening process.
Persists the state of a channel opening process after funding
transaction is confirmed. This tracks the messages sent to
the peer such that the process can be continued in case of a
restart. Also introduces that the receiver side forgets about
channel if funding transaction is not confirmed in 48hrs.
2017-08-10 13:14:25 -07:00
Johan T. Halseth
bd0465ee1d channeldb: support adding partial LightningNodes to graph.
Adds a HaveNodeAnnouncement field to the LightningNode
struct, which is used to indicate if we have gotten
all the necessary information to fill the remaining
fields in the struct. If we haven't gotten a node
announcement for this specific node, then we only
know the pubkey, and can only fill that field in
the struct. Still, we should be able to add it to the
channel graph and use it for routes, as long as we
know about channels to this node.
2017-08-02 15:58:58 -07:00
Olaoluwa Osuntokun
88c15abeef
channeldb: remove RevocationDelay field from the HTLC struct
This commit removes the RevocationDelay field from the HTLC struct as
with the latest commitment transaction scheme, it is no longer needed.
This is due to the fact the the delay is now observed when an on-chain
HTLC claim is attempted, rather than from Shane the HTLC itself has
been broadcast.
2017-07-30 17:48:32 -07:00
Olaoluwa Osuntokun
5ad6c23848
channeldb: update tests to reflect latest OpenChannel/HTLC API changes 2017-07-30 17:48:26 -07:00
Olaoluwa Osuntokun
5854ffb644
channeldb: add InsertNextRevocation method to OpenChannel
This commit adds a new method to the OpenChannel struct:
InsertNextRevocation. This functionality is required in order to
properly implement the new funding workflow and commitment transaction
state machine.

In the prior state machine, we utilized the “initial revocation window”
which would provide both sides with the necessary revocation keys that
they needed to create new commitment states. The version of the
commitment state machine within the specification has been simplified a
bit, and instead essentially incorporates a revocation window of 1. The
window is initially filled at the _opening_ of the commitment
transaction, then never extended, only “slid down” from there on.
2017-07-30 17:48:22 -07:00
Olaoluwa Osuntokun
a14072a47e
channeldb: store the second-level HTLC signature along with HTLC's
This commit modifies the HTLC struct within the channeldb struct in
order to accommodate the additional storage that’s now required as a
result of the change to 2-of-2 HTLC covenant transactions within the
commitment transaction.
2017-07-30 17:48:19 -07:00
Olaoluwa Osuntokun
9811b404e4
channeldb: integrate ChannelConfig and ChannelConstraints into OpenChannel
This commit is the next phase in a rather major overhaul of the
OpenChannel struct. With this commit we remove the old ours vs theirs
semantics with channel related state variables, and instead encapsulate
all local vs remote state into a ChannelConfig structure for each party
within the channel.
2017-07-30 17:48:16 -07:00
Olaoluwa Osuntokun
5780992f8d
channeldb: eliminate ChanID in favor of FundingOutpoint
This commit eliminates a bit of redundancy within the OpenChannel
struct by eschewing the ChanID field, in favor of simply the
FundingOutpoint field.
2017-07-30 17:48:13 -07:00