diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-14 19:45:22 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-16 23:21:55 +0100 |
commit | 93e3d52735b35a0b5405ed774a5bf0dbc8d8e8f2 (patch) | |
tree | ed35d024b8fa99eebe10058ebae29e0e8af56b2e /src/wallet.ts | |
parent | af6843a2aa9c0e35d5d400adc85c51af83673eeb (diff) |
remove repurchase correlation id
Diffstat (limited to 'src/wallet.ts')
-rw-r--r-- | src/wallet.ts | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/wallet.ts b/src/wallet.ts index 67393edae..01d26c297 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -24,7 +24,6 @@ import { AmountJson, Amounts, - CheckRepurchaseResult, CoinRecord, CoinPaySig, Contract, @@ -349,10 +348,6 @@ export namespace Stores { super("transactions", {keyPath: "contractHash"}); } - repurchaseIndex = new Index<[string,string],TransactionRecord>(this, "repurchase", [ - "contract.merchant_pub", - "contract.repurchase_correlation_id" - ]); fulfillmentUrlIndex = new Index<string,TransactionRecord>(this, "fulfillment_url", "contract.fulfillment_url"); orderIdIndex = new Index<string,TransactionRecord>(this, "order_id", "contract.order_id"); } @@ -1691,34 +1686,6 @@ export class Wallet { return this.cryptoApi.hashString(canonicalJson(contract)); } - /** - * Check if there's an equivalent contract we've already purchased. - */ - async checkRepurchase(contract: Contract): Promise<CheckRepurchaseResult> { - if (!contract.repurchase_correlation_id) { - console.log("no repurchase: no correlation id"); - return {isRepurchase: false}; - } - let result: TransactionRecord|undefined = await ( - this.q() - .getIndexed(Stores.transactions.repurchaseIndex, - [ - contract.merchant_pub, - contract.repurchase_correlation_id - ])); - - if (result) { - console.assert(result.contract.repurchase_correlation_id == contract.repurchase_correlation_id); - return { - isRepurchase: true, - existingContractHash: result.contractHash, - existingFulfillmentUrl: result.contract.fulfillment_url, - }; - } else { - return {isRepurchase: false}; - } - } - /** * Generate a nonce in form of an EdDSA public key. |