Skip to content

Commit cd13198

Browse files
author
Mark Tyneway
committed
wallet: create revoke lock
1 parent 4d505be commit cd13198

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

lib/wallet/wallet.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,32 +3018,52 @@ class Wallet extends EventEmitter {
30183018
}
30193019

30203020
/**
3021-
* Create and finalize an update MTX.
3021+
* Create and finalize a revoke
3022+
* MTX without a lock.
30223023
* @param {String} name
30233024
* @param {Object} options
30243025
* @returns {MTX}
30253026
*/
30263027

3027-
async createRevoke(name, options) {
3028+
async _createRevoke(name, options) {
30283029
const mtx = await this.makeRevoke(name);
30293030
await this.fill(mtx, options);
30303031
return this.finalize(mtx, options);
30313032
}
30323033

30333034
/**
3034-
* Create and send an update MTX.
3035+
* Create and finalize a revoke
3036+
* MTX with a lock.
3037+
* @param {String} name
3038+
* @param {Object} options
3039+
* @returns {MTX}
3040+
*/
3041+
3042+
async createRevoke(name, options) {
3043+
const unlock = await this.fundLock.lock();
3044+
try {
3045+
return await this._createRevoke(name, options);
3046+
} finally {
3047+
unlock();
3048+
}
3049+
}
3050+
3051+
/**
3052+
* Create and send a revoke
3053+
* MTX without a lock.
30353054
* @param {String} name
30363055
* @param {Object} options
30373056
*/
30383057

30393058
async _sendRevoke(name, options) {
30403059
const passphrase = options ? options.passphrase : null;
3041-
const mtx = await this.createRevoke(name);
3060+
const mtx = await this._createRevoke(name);
30423061
return this.sendMTX(mtx, passphrase);
30433062
}
30443063

30453064
/**
3046-
* Create and send an update MTX.
3065+
* Create and send a revoke
3066+
* MTX with a lock.
30473067
* @param {String} name
30483068
* @param {Object} options
30493069
*/

0 commit comments

Comments
 (0)