Skip to content

Commit

Permalink
fix(core-transactions): add ipfs exception handling (#3217)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored and faustbrian committed Nov 6, 2019
1 parent e462e76 commit 159098b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/core-transactions/src/handlers/ipfs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Database, State, TransactionPool } from "@arkecosystem/core-interfaces";
import { Interfaces, Managers, Transactions } from "@arkecosystem/crypto";
import { Interfaces, Managers, Transactions, Utils } from "@arkecosystem/crypto";
import { IpfsHashAlreadyExists } from "../errors";
import { TransactionReader } from "../transaction-reader";
import { TransactionHandler, TransactionHandlerConstructor } from "./transaction";
Expand Down Expand Up @@ -45,6 +45,10 @@ export class IpfsTransactionHandler extends TransactionHandler {
wallet: State.IWallet,
walletManager: State.IWalletManager,
): Promise<void> {
if (Utils.isException(transaction.data)) {
return;
}

if (walletManager.getIndex("ipfs").has(transaction.data.asset.ipfs)) {
throw new IpfsHashAlreadyExists();
}
Expand Down
5 changes: 4 additions & 1 deletion packages/crypto/src/networks/devnet/exceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"547ff32c8e709b6f2c79bf78b0c39d82cd6b845705be1c4263f0107b8b1f8ec1",
"04d772ff7977051c7515e29eeafa283af843cbc0364c109ae6c04884df608d93",
"c2d02bd4475c84222bd7eddd13743b319cdd0596cf4fd1f4303ac9a2d158f302",
"baa9d3d9ed8d57f1d4b0233ecdf00ef8f12e28ceb764e62cece2afef1c358d60"
"baa9d3d9ed8d57f1d4b0233ecdf00ef8f12e28ceb764e62cece2afef1c358d60",
"a4e312e7ba1376440061f3c3ffe529c16b64489862ffb979b904f491985de1a1",
"11561c1354e6ceaf2c269916bf21e2fed1acb995a609deb340cec867f6bf7005",
"98342cce815de243f42d346b67715fa5fb7dc1eb37631f2d6425ed9003a83bc5"
]
}

0 comments on commit 159098b

Please sign in to comment.