haskoin-store 0.26.3 → 0.26.4
raw patch · 3 files changed
+31/−30 lines, 3 filesdep ~haskoin-store-data
Dependency ranges changed: haskoin-store-data
Files
- haskoin-store.cabal +5/−5
- src/Haskoin/Store/Cache.hs +7/−8
- src/Haskoin/Store/Logic.hs +19/−17
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: aa22c0a2b15ff3fca854ff7a28d2d69f11c446cea2307b746b8823bfbc7f0919+-- hash: f31c38533b616fd5c81e849bb14ff8b6c3294bbb3e1c90432b9f6b3e08809ad8 name: haskoin-store-version: 0.26.3+version: 0.26.4 synopsis: Storage and index for Bitcoin and Bitcoin Cash description: Store and index Bitcoin or Bitcoin Cash blocks, transactions, balances and unspent outputs. All data is available via REST API in JSON or binary format.@@ -57,7 +57,7 @@ , hashable >=1.3.0.0 , haskoin-core >=0.13.3 , haskoin-node >=0.13.0- , haskoin-store-data ==0.26.3+ , haskoin-store-data ==0.26.4 , hedis >=0.12.13 , http-types >=0.12.3 , monad-logger >=0.3.32@@ -99,7 +99,7 @@ , haskoin-core >=0.13.3 , haskoin-node >=0.13.0 , haskoin-store- , haskoin-store-data ==0.26.3+ , haskoin-store-data ==0.26.4 , monad-logger >=0.3.32 , mtl >=2.2.2 , nqe >=0.6.1@@ -149,7 +149,7 @@ , hashable >=1.3.0.0 , haskoin-core >=0.13.3 , haskoin-node >=0.13.0- , haskoin-store-data ==0.26.3+ , haskoin-store-data ==0.26.4 , hedis >=0.12.13 , hspec >=2.7.1 , http-types >=0.12.3
src/Haskoin/Store/Cache.hs view
@@ -663,7 +663,8 @@ Just newhead -> go newhead cachehead go newhead cachehead | cachehead == newhead = do- $(logDebugS) "Cache" $ "Blocks in sync: " <> blockHashToHex cachehead+ $(logDebugS) "Cache" $+ "Blocks in sync: " <> blockHashToHex cachehead syncMempoolC | otherwise = asks cacheChain >>= \ch ->@@ -700,13 +701,11 @@ asks cacheChain >>= \ch -> chainGetAncestor (nodeHeight cacheheadnode + 1) newheadnode ch >>= \case Nothing -> do- let txt =- "Ancestor not found at height " <>- cs (show (nodeHeight cacheheadnode + 1)) <>- " for block: " <>- blockHashToHex (headerHash (nodeHeader newheadnode))- $(logErrorS) "Cache" txt- throwIO $ LogicError $ cs txt+ $(logErrorS) "Cache" $+ "Ancestor not found at height " <>+ cs (show (nodeHeight cacheheadnode + 1)) <>+ " for block: " <>+ blockHashToHex (headerHash (nodeHeader newheadnode)) Just newcachenode -> importBlockC (headerHash (nodeHeader newcachenode)) >> f
src/Haskoin/Store/Logic.hs view
@@ -226,18 +226,19 @@ -> Tx -> m [TxHash] -- ^ deleted transactions importTx br tt tx = do- unless (confirmed br) $+ unless (confirmed br) $ do $(logDebugS) "BlockStore" $- "Importing transaction " <> txHashToHex (txHash tx)- when (length (nub (map prevOutput (txIn tx))) < length (txIn tx)) $ do- $(logErrorS) "BlockStore" $- "Transaction spends same output twice: " <> txHashToHex (txHash tx)- throwError (DuplicatePrevOutput (txHashToHex (txHash tx)))- when (iscb && not (confirmed br)) $ do- $(logErrorS) "BlockStore" $- "Coinbase cannot be imported into mempool: " <>- txHashToHex (txHash tx)- throwError (UnconfirmedCoinbase (txHashToHex (txHash tx)))+ "Importing transaction " <> txHashToHex (txHash tx)+ when (length (nub (map prevOutput (txIn tx))) < length (txIn tx)) $ do+ $(logErrorS) "BlockStore" $+ "Transaction spends same output twice: " <>+ txHashToHex (txHash tx)+ throwError (DuplicatePrevOutput (txHashToHex (txHash tx)))+ when iscb $ do+ $(logErrorS) "BlockStore" $+ "Coinbase cannot be imported into mempool: " <>+ txHashToHex (txHash tx)+ throwError (UnconfirmedCoinbase (txHashToHex (txHash tx))) us' <- if iscb then return []@@ -462,16 +463,17 @@ => BlockRef -> Tx -> m Bool-isRBF br tx =- getNetwork >>= \net ->- if getReplaceByFee net- then go- else return False+isRBF br tx+ | confirmed br = return False+ | otherwise =+ getNetwork >>= \net ->+ if getReplaceByFee net+ then go+ else return False where go | all (== nullOutPoint) (map prevOutput (txIn tx)) = return False | any ((< 0xffffffff - 1) . txInSequence) (txIn tx) = return True- | confirmed br = return False | otherwise = let hs = nub $ map (outPointHash . prevOutput) (txIn tx) ck [] = return False