1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-23 06:35:11 +01:00

sig mismatch are now logged as errors

This commit is contained in:
pm47 2015-08-28 18:20:38 +02:00
parent a164088163
commit a76cda2c00
2 changed files with 4 additions and 1 deletions

View file

@ -66,7 +66,6 @@
<appender-ref ref="BOB"/>
<appender-ref ref="BLOCKCHAIN"/>
<appender-ref ref="CONSOLE"/>
</root>
</configuration>

View file

@ -162,6 +162,7 @@ class Node(val blockchain: ActorRef, val commitPrivKey: BinaryData, val finalPri
val signedCommitTx = newCommitTx.tx.updateSigScript(0, sigScript2of2(theirSig, ourSig, theirParams.commitKey, ourParams.commitKey))
val ok = Try(Transaction.correctlySpends(signedCommitTx, Map(OutPoint(anchorTx.hash, anchorOutputIndex) -> multiSig2of2(ourParams.commitKey, theirParams.commitKey)), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)).isSuccess
// TODO : return Error and close channel if !ok
if (!ok) log.error(s"invalid sig")
blockchain ! Watch(anchorTx.hash)
blockchain ! Publish(anchorTx)
goto(OPEN_WAITING_OURANCHOR) using DATA_OPEN_WAITING(ourParams, theirParams, newCommitTx.copy(tx = signedCommitTx))
@ -310,6 +311,7 @@ class Node(val blockchain: ActorRef, val commitPrivKey: BinaryData, val finalPri
val signedCommitTx = newCommitmentTx.updateSigScript(0, sigScript2of2(theirSig, ourSig, theirParams.commitKey, ourParams.commitKey))
val ok = Try(Transaction.correctlySpends(signedCommitTx, Map(previous.tx.txIn(0).outPoint -> multiSig2of2(ourParams.commitKey, theirParams.commitKey)), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)).isSuccess
// TODO : return Error and close channel if !ok
if (!ok) log.error(s"invalid sig")
them ! update_signature(ourSig, previous.ourRevocationPreimage)
goto(WAIT_FOR_UPDATE_COMPLETE) using DATA_WAIT_FOR_UPDATE_COMPLETE(ourParams, theirParams, previous, CommitmentTx(signedCommitTx, newState, ourRevocationHashPreimage, theirRevocationHash))
}
@ -323,6 +325,7 @@ class Node(val blockchain: ActorRef, val commitPrivKey: BinaryData, val finalPri
val signedCommitTx = newCommitmentTx.updateSigScript(0, sigScript2of2(theirSig, ourSig, theirParams.commitKey, ourParams.commitKey))
val ok = Try(Transaction.correctlySpends(signedCommitTx, Map(previous.tx.txIn(0).outPoint -> multiSig2of2(ourParams.commitKey, theirParams.commitKey)), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)).isSuccess
// TODO : return Error and close channel if !ok
if (!ok) log.error(s"invalid sig")
them ! update_signature(ourSig, previous.ourRevocationPreimage)
goto(WAIT_FOR_UPDATE_COMPLETE) using DATA_WAIT_FOR_UPDATE_COMPLETE(ourParams, theirParams, previous, CommitmentTx(signedCommitTx, newState, ourRevocationHashPreimage, theirRevocationHash))
}
@ -336,6 +339,7 @@ class Node(val blockchain: ActorRef, val commitPrivKey: BinaryData, val finalPri
val signedCommitTx = newCommitmentTx.tx.updateSigScript(0, sigScript2of2(theirSig, ourSig, theirParams.commitKey, ourParams.commitKey))
val ok = Try(Transaction.correctlySpends(signedCommitTx, Map(previousCommitmentTx.tx.txIn(0).outPoint -> multiSig2of2(ourParams.commitKey, theirParams.commitKey)), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)).isSuccess
// TODO : return Error and close channel if !ok
if (!ok) log.error(s"invalid sig")
them ! update_complete(previousCommitmentTx.ourRevocationPreimage)
goto(NORMAL) using DATA_NORMAL(ourParams, theirParams, newCommitmentTx.copy(tx = signedCommitTx))
}