Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
928f73d
integration tests: upgrade to bitcoin 0.17.1
sstone Dec 14, 2018
ae06315
Add pushMe output script
araspitzu Feb 4, 2019
0193a2c
Add feature bits
araspitzu Feb 4, 2019
7ebbf0e
Add helper to check whether this channel uses option_simplified_commi…
araspitzu Feb 4, 2019
65412e6
Read option_simplified_commitment from localParams
araspitzu Feb 5, 2019
6ce78a0
Do not rotate remote_pubkey if option_simplified_commitment is enabled
araspitzu Feb 5, 2019
cc4ed34
Create commitTx with pushMe outputs
araspitzu Feb 5, 2019
0f00a68
Remove empty lines
araspitzu Feb 5, 2019
78cd70e
Use p2wsh for pushMe outputs
araspitzu Feb 5, 2019
2f5adce
If option_simplified_commitment don't send my_current_per_commitment_…
araspitzu Feb 5, 2019
63e6e48
WIP abstracting Commitments
araspitzu Feb 12, 2019
762e48d
Merge branch 'master' into use-bitcoin-0.17.1
sstone Feb 12, 2019
581f5e1
WIP Typed commitment
araspitzu Feb 13, 2019
65bbab9
Bitcoin RPC: use `signrawtransactionwithwallet`
sstone Feb 12, 2019
3994d97
Typed commitment - scodec support
araspitzu Feb 13, 2019
018efa3
Comments, formatting, renaming
araspitzu Feb 13, 2019
8cbe347
Add scripts spending the push_me outputs
araspitzu Feb 14, 2019
f9d4029
Add to_remote delayed output script, use it in 'Transactions.makeComm…
araspitzu Feb 14, 2019
5e2a86e
WIP introduced CommitmentContext, port 'makeClaimP2WPKHOutputTx' to s…
araspitzu Feb 15, 2019
7e3ae46
WIP 'makeCommitTx' to simplified_commitment and Context
araspitzu Feb 15, 2019
a5f660e
WIP port 'makeClaimDelayedOutputTx' to simplified/context
araspitzu Feb 15, 2019
f503ad0
WIP port 'makeMainPenaltyTx' to simplified/context
araspitzu Feb 15, 2019
ba27767
Comment cleanup
araspitzu Feb 15, 2019
a76e07c
Add feature test for option_simplified_commitment
araspitzu Feb 15, 2019
4009ff5
Use p2wsh when looking for the pushMeOutput index
araspitzu Feb 18, 2019
88c780c
Add more thorough test for detecting option_simplified_commitment
araspitzu Feb 18, 2019
5d2d3a2
Seal the commitments trait
araspitzu Feb 18, 2019
9b320a7
Create correct commitment type on receiving 'funding_created', add test
araspitzu Feb 18, 2019
cff7d3a
Reorg test
araspitzu Feb 18, 2019
1837a58
Remove unnecessary Alice from test fixtures
araspitzu Feb 18, 2019
44c6234
Introduce 'CannotUpdateFeeWithCommitmentType' add test for receiving …
araspitzu Feb 18, 2019
66ea646
Rename variables in 'canUseSimplifiedCommitment'
araspitzu Feb 18, 2019
ac078be
Add test for receiving `update_add_htlc` in simplified_commitment mode
araspitzu Feb 18, 2019
054dd9d
Use remote_delayedpubkey to the to_remote_pushme
araspitzu Feb 19, 2019
1fadb53
Add test to check remote_pubkey is not rotated across commitments.
araspitzu Feb 20, 2019
e25efda
Rename test, reorg code
araspitzu Feb 20, 2019
1ee7b1f
Use previous perCommitmentPoint if we received a commit_sig while wai…
araspitzu Feb 20, 2019
5c5dda7
Remove leftover char
araspitzu Feb 20, 2019
b176931
Add commit structure test for option_simplified_commitment
araspitzu Feb 21, 2019
1695912
Rework comments
araspitzu Feb 21, 2019
e3cc72d
Merge branch 'master' into use-bitcoin-0.17.1
sstone Feb 25, 2019
3f8f328
Remove unused travis files
sstone Feb 25, 2019
9504c51
Pass sigHash to sign functions, sign with SIGHASH_SINGLE | SIGHASH_AN…
Mar 1, 2019
9fd1e95
Add comments
Mar 1, 2019
ae0d25a
Merge branch 'master' into simplified_commitment
Mar 1, 2019
679ece1
Finish merging master
Mar 1, 2019
3b5da6f
Add test for send/receive hltc (commitSig + revokeAndAck) with option…
Mar 1, 2019
6de1495
Negotiate closing tx *upwards* from fundee->funder
Mar 1, 2019
fabd4d0
Merge branch 'master' into use-bitcoin-0.17.1
sstone Mar 2, 2019
e9fb058
Bitcoin Wallet: cleaner handling of signtransaction errors
sstone Mar 2, 2019
de83752
Check that bitcoind version is 0.17.0 or higher
sstone Mar 3, 2019
794c0d7
WIP closing
Mar 4, 2019
d916bd8
Merge remote-tracking branch 'origin/simplified_commitment' into simp…
araspitzu Mar 4, 2019
ae7fafd
Negotiate closing tx *upwards* from fundee->funder
araspitzu Mar 4, 2019
a709991
Use feerate_kw=0 when computing HTLC-TX fees
araspitzu Mar 4, 2019
bdab013
Print commitment type in toString helpers
araspitzu Mar 4, 2019
25e046e
WIP claim main delayed output with option_simplified_commitment
araspitzu Mar 4, 2019
90daf55
Add pushMe trasaction to LocalCommitPublished, WIP CPFP..
araspitzu Mar 5, 2019
3151360
BitcoinCoreWallet: add signing tests with multiple bad inputs
sstone Mar 6, 2019
e52e385
Merge branch 'master' into use-bitcoin-0.17.1
sstone Mar 6, 2019
a752d65
BitcoinCoreWalletSpec: fix formatting issue
sstone Mar 6, 2019
9a1aa6e
Reintroduce non-typed design, commit version/context inside Commitments
araspitzu Mar 7, 2019
fcd0ea3
Rename CommitmentContext => CommitmentVersion
araspitzu Mar 7, 2019
610cea8
Rename context => version in function params
araspitzu Mar 7, 2019
178d6cf
Add test for backward compatibility (broken)
araspitzu Mar 7, 2019
b27dc86
Simplify scodecs for stateData (broken test)
araspitzu Mar 7, 2019
c3540b3
Fail decoding if there are remaining bits
araspitzu Mar 7, 2019
da11388
Fix test for backward compatible reads of stored commitments
araspitzu Mar 8, 2019
e8f229e
Migrate commitmentVersion implicits to standard parameter
araspitzu Mar 8, 2019
f662a6a
Merge branch 'master' into use-bitcoin-0.17.1
sstone Mar 14, 2019
d791c52
Merge branch 'master' into simplified_commitmeint_more_simplified
araspitzu Mar 14, 2019
90c3295
Finish merging master
araspitzu Mar 14, 2019
31ce0c6
Fix transactions unit test
sstone Mar 14, 2019
171ddca
Fix encoding with DATA_WAIT_FOR_FUNDING_CONFIRMED_COMPAT_01_Codec
araspitzu Mar 14, 2019
1d17727
Merge remote-tracking branch 'origin/use-bitcoin-0.17.1' into simplif…
araspitzu Mar 14, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions eclair-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-x86_64-linux-gnu.tar.gz
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
</bitcoind.url>
<bitcoind.md5>c371e383f024c6c45fb255d528a6beec</bitcoind.md5>
<bitcoind.sha1>e6d8ab1f7661a6654fd81e236b9b5fd35a3d4dcb</bitcoind.sha1>
<bitcoind.md5>724043999e2b5ed0c088e8db34f15d43</bitcoind.md5>
<bitcoind.sha1>546ee35d4089c7ccc040a01cdff3362599b8bc53</bitcoind.sha1>
</properties>
</profile>
<profile>
Expand All @@ -93,10 +93,10 @@
</os>
</activation>
<properties>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-osx64.tar.gz
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-osx64.tar.gz
</bitcoind.url>
<bitcoind.md5>bacd87d0c3f65a5acd666e33d094a59e</bitcoind.md5>
<bitcoind.sha1>62cc5bd9ced610bb9e8d4a854396bfe2139e3d0f</bitcoind.sha1>
<bitcoind.md5>b5a792c6142995faa42b768273a493bd</bitcoind.md5>
<bitcoind.sha1>8bd51c7024d71de07df381055993e9f472013db8</bitcoind.sha1>
</properties>
</profile>
<profile>
Expand All @@ -107,9 +107,9 @@
</os>
</activation>
<properties>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-win64.zip</bitcoind.url>
<bitcoind.md5>bbde9b1206956d19298034319e9f405e</bitcoind.md5>
<bitcoind.sha1>85e3dc8a9c6f93b1b20cb79fa5850b5ce81da221</bitcoind.sha1>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-win64.zip</bitcoind.url>
<bitcoind.md5>b0e824e9dd02580b5b01f073f3c89858</bitcoind.md5>
<bitcoind.sha1>4e17bad7d08c465b444143a93cd6eb1c95076e3f</bitcoind.sha1>
</properties>
</profile>
</profiles>
Expand Down
3 changes: 2 additions & 1 deletion eclair-core/src/main/scala/fr/acinq/eclair/Features.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ object Features {
val CHANNEL_RANGE_QUERIES_BIT_MANDATORY = 6
val CHANNEL_RANGE_QUERIES_BIT_OPTIONAL = 7

val OPTION_SIMPLIFIED_COMMITMENT_MANDATORY = 8
val OPTION_SIMPLIFIED_COMMITMENT_OPTIONAL = 9

def hasFeature(features: BitSet, bit: Int): Boolean = features.get(bit)

def hasFeature(features: ByteVector, bit: Int): Boolean = hasFeature(BitSet.valueOf(features.reverse.toArray), bit)


/**
* Check that the features that we understand are correctly specified, and that there are no mandatory features that
* we don't understand (even bits)
Expand Down
4 changes: 1 addition & 3 deletions eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,13 @@ class Setup(datadir: File,
} yield (progress, chainHash, bitcoinVersion, unspentAddresses, blocks, headers)
// blocking sanity checks
val (progress, chainHash, bitcoinVersion, unspentAddresses, blocks, headers) = await(future, 30 seconds, "bicoind did not respond after 30 seconds")
assert(bitcoinVersion >= 160300, "Eclair requires Bitcoin Core 0.16.3 or higher")
assert(bitcoinVersion >= 170000, "Eclair requires Bitcoin Core 0.17.0 or higher")
assert(chainHash == nodeParams.chainHash, s"chainHash mismatch (conf=${nodeParams.chainHash} != bitcoind=$chainHash)")
if (chainHash != Block.RegtestGenesisBlock.hash) {
assert(unspentAddresses.forall(address => !isPay2PubkeyHash(address)), "Make sure that all your UTXOS are segwit UTXOS and not p2pkh (check out our README for more details)")
}
assert(progress > 0.999, s"bitcoind should be synchronized (progress=$progress")
assert(headers - blocks <= 1, s"bitcoind should be synchronized (headers=$headers blocks=$blocks")
// TODO: add a check on bitcoin version?

Bitcoind(bitcoinClient)
case ELECTRUM =>
val addresses = config.hasPath("electrum") match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ package fr.acinq.eclair.blockchain.bitcoind
import fr.acinq.bitcoin._
import fr.acinq.eclair._
import fr.acinq.eclair.blockchain._
import fr.acinq.eclair.blockchain.bitcoind.rpc.{BitcoinJsonRPCClient, JsonRPCError}
import fr.acinq.eclair.blockchain.bitcoind.rpc.{BitcoinJsonRPCClient, Error, JsonRPCError}
import fr.acinq.eclair.transactions.Transactions
import grizzled.slf4j.Logging
import org.json4s.DefaultFormats
import org.json4s.JsonAST._
import org.json4s.jackson.Serialization
import scodec.bits.ByteVector

import scala.concurrent.{ExecutionContext, Future}
Expand All @@ -47,9 +49,13 @@ class BitcoinCoreWallet(rpcClient: BitcoinJsonRPCClient)(implicit ec: ExecutionC
def fundTransaction(tx: Transaction, lockUnspents: Boolean, feeRatePerKw: Long): Future[FundTransactionResponse] = fundTransaction(Transaction.write(tx).toHex, lockUnspents, feeRatePerKw)

def signTransaction(hex: String): Future[SignTransactionResponse] =
rpcClient.invoke("signrawtransaction", hex).map(json => {
rpcClient.invoke("signrawtransactionwithwallet", hex).map(json => {
val JString(hex) = json \ "hex"
val JBool(complete) = json \ "complete"
if (!complete) {
val message = (json \ "errors" \\ classOf[JString]).mkString(",")
throw new JsonRPCError(Error(-1, message))
}
SignTransactionResponse(Transaction.read(hex), complete)
})

Expand All @@ -74,7 +80,7 @@ class BitcoinCoreWallet(rpcClient: BitcoinJsonRPCClient)(implicit ec: ExecutionC

private def signTransactionOrUnlock(tx: Transaction): Future[SignTransactionResponse] = {
val f = signTransaction(tx)
// if signature fails (e.g. because wallet is uncrypted) we need to unlock the utxos
// if signature fails (e.g. because wallet is encrypted) we need to unlock the utxos
f.recoverWith { case _ =>
unlockOutpoints(tx.txIn.map(_.outPoint))
.recover { case t: Throwable => logger.warn(s"Cannot unlock failed transaction's UTXOs txid=${tx.txid}", t); t } // no-op, just add a log in case of failure
Expand All @@ -94,7 +100,7 @@ class BitcoinCoreWallet(rpcClient: BitcoinJsonRPCClient)(implicit ec: ExecutionC
// we ask bitcoin core to add inputs to the funding tx, and use the specified change address
FundTransactionResponse(unsignedFundingTx, _, fee) <- fundTransaction(partialFundingTx, lockUnspents = true, feeRatePerKw)
// now let's sign the funding tx
SignTransactionResponse(fundingTx, _) <- signTransactionOrUnlock(unsignedFundingTx)
SignTransactionResponse(fundingTx, true) <- signTransactionOrUnlock(unsignedFundingTx)
// there will probably be a change output, so we need to find which output is ours
outputIndex = Transactions.findPubKeyScriptIndex(fundingTx, pubkeyScript, outputsAlreadyUsed = Set.empty, amount_opt = None)
_ = logger.debug(s"created funding txid=${fundingTx.txid} outputIndex=$outputIndex fee=$fee")
Expand Down
Loading