@@ -3039,15 +3039,21 @@ class Wallet extends EventEmitter {
30393039 /**
30403040 * Make a revoke MTX.
30413041 * @param {String } name
3042+ * @param {String|Number } acct
30423043 * @returns {MTX }
30433044 */
30443045
3045- async makeRevoke ( name ) {
3046+ async makeRevoke ( name , acct ) {
30463047 assert ( typeof name === 'string' ) ;
30473048
30483049 if ( ! rules . verifyName ( name ) )
30493050 throw new Error ( 'Invalid name.' ) ;
30503051
3052+ if ( acct != null ) {
3053+ assert ( ( acct >>> 0 ) === acct || typeof acct === 'string' ) ;
3054+ acct = await this . getAccountIndex ( acct ) ;
3055+ }
3056+
30513057 const rawName = Buffer . from ( name , 'ascii' ) ;
30523058 const nameHash = rules . hashName ( rawName ) ;
30533059 const ns = await this . getNameState ( nameHash ) ;
@@ -3063,6 +3069,9 @@ class Wallet extends EventEmitter {
30633069 if ( ! coin )
30643070 throw new Error ( `Wallet does not own: "${ name } ".` ) ;
30653071
3072+ if ( acct != null && ! await this . txdb . hasCoinByAccount ( acct , hash , index ) )
3073+ throw new Error ( `Account does not own: "${ name } ".` ) ;
3074+
30663075 // Is local?
30673076 if ( coin . height < ns . height )
30683077 throw new Error ( `Wallet does not own: "${ name } ".` ) ;
@@ -3106,7 +3115,8 @@ class Wallet extends EventEmitter {
31063115 */
31073116
31083117 async _createRevoke ( name , options ) {
3109- const mtx = await this . makeRevoke ( name ) ;
3118+ const acct = options ? options . account : null ;
3119+ const mtx = await this . makeRevoke ( name , acct ) ;
31103120 await this . fill ( mtx , options ) ;
31113121 return this . finalize ( mtx , options ) ;
31123122 }
@@ -3137,7 +3147,7 @@ class Wallet extends EventEmitter {
31373147
31383148 async _sendRevoke ( name , options ) {
31393149 const passphrase = options ? options . passphrase : null ;
3140- const mtx = await this . _createRevoke ( name ) ;
3150+ const mtx = await this . _createRevoke ( name , options ) ;
31413151 return this . sendMTX ( mtx , passphrase ) ;
31423152 }
31433153
0 commit comments