bitcoin-payment-channel 0.6.0.0 → 0.6.0.1
raw patch · 4 files changed
+16/−15 lines, 4 files
Files
- bitcoin-payment-channel.cabal +1/−1
- src/Data/Bitcoin/PaymentChannel.hs +2/−1
- src/Data/Bitcoin/PaymentChannel/Internal/Payment.hs +10/−10
- src/Data/Bitcoin/PaymentChannel/Test.hs +3/−3
bitcoin-payment-channel.cabal view
@@ -1,5 +1,5 @@ name: bitcoin-payment-channel-version: 0.6.0.0+version: 0.6.0.1 synopsis: Library for working with Bitcoin payment channels description: A Bitcoin payment channel allows secure and instant transfer of bitcoins from one
src/Data/Bitcoin/PaymentChannel.hs view
@@ -135,6 +135,7 @@ import qualified Network.Haskoin.Crypto as HC import qualified Network.Haskoin.Transaction as HT+import Network.Haskoin.Internals (toPubKeyG) import Data.Time.Clock (UTCTime(..)) import Data.Time.Calendar (Day(..)) @@ -241,7 +242,7 @@ Right state else Left SigVerifyFailed- where verifySenderPayment hash pk sig = HC.verifySig hash sig (getPubKey pk)+ where verifySenderPayment hash pk sig = HC.verifySig hash sig (toPubKeyG $ getPubKey pk) -- |Same as 'recvPayment' but accept only a payment of zero value -- with a new client change address. Used to produce the settlement
src/Data/Bitcoin/PaymentChannel/Internal/Payment.hs view
@@ -88,7 +88,7 @@ verifyPaymentSig ::- ChannelParameters+ ChannelParameters -> FundingTxInfo -> HC.Address -> SendPubKey@@ -98,16 +98,16 @@ verifyPaymentSig cp (CFundingTxInfo fundTxId idx val) changeAddr sendPK verifyFunc (CPayment newSenderVal (CPaymentSignature sig sigHash)) = let- payProxy = UnsignedPayment- (HT.OutPoint fundTxId idx) val (getRedeemScript cp)- changeAddr newSenderVal- hash = case sigHash of- HS.SigSingle True -> getHashForSigning payProxy sigHash- --sender has relinquished remaining channel value- HS.SigNone True -> getHashForSigning payProxy sigHash- _ -> dummyHash256 --will fail verification+ payProxy = UnsignedPayment (HT.OutPoint fundTxId idx) val + (getRedeemScript cp) changeAddr newSenderVal+ verify = verifyFunc (getHashForSigning payProxy sigHash) sendPK sig in- verifyFunc hash sendPK sig+ case sigHash of+ HS.SigSingle True -> verify+ -- Sender has relinquished remaining channel value+ HS.SigNone True -> verify+ _ -> False+ verifyPaymentSigFromState :: PaymentChannelState
src/Data/Bitcoin/PaymentChannel/Test.hs view
@@ -14,7 +14,7 @@ import Data.Bitcoin.PaymentChannel.Internal.Types import Data.Bitcoin.PaymentChannel.Util import Data.Bitcoin.PaymentChannel.Internal.State hiding (channelIsExhausted, channelValueLeft)-+import Network.Haskoin.Internals (toPrvKeyG) import qualified Network.Haskoin.Crypto as HC import Network.Haskoin.Test import Data.Time.Clock (UTCTime(..))@@ -102,12 +102,12 @@ initPayAmount <- arbitrary -- create states let (initPayActualAmount,paymnt,sendChan) = channelWithInitialPaymentOf defaultConfig- cp fti (flip HC.signMsg sendPriv) (getFundingAddress cp) initPayAmount+ cp fti (`HC.signMsg` toPrvKeyG sendPriv) (getFundingAddress cp) initPayAmount let eitherRecvChan = channelFromInitialPayment nowishTimestamp defaultConfig cp fti paymnt case eitherRecvChan of Left e -> error (show e) Right (initRecvAmount,recvChan) -> return (ArbChannelPair sendChan recvChan [initPayActualAmount] [initRecvAmount]- (flip HC.signMsg recvPriv),+ (`HC.signMsg` toPrvKeyG recvPriv), paymnt)