From 37a3f833343628d58431cf99ec6add99ff62d343 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 18 Dec 2016 20:41:30 -0800 Subject: [PATCH] keyring: add refresh method. --- lib/primitives/keyring.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/primitives/keyring.js b/lib/primitives/keyring.js index 04f61f22..ffda6de7 100644 --- a/lib/primitives/keyring.js +++ b/lib/primitives/keyring.js @@ -105,6 +105,21 @@ KeyRing.fromOptions = function fromOptions(options) { return new KeyRing().fromOptions(options); }; +/** + * Clear cached key/script hashes. + */ + +KeyRing.prototype.refresh = function refresh() { + this._keyHash = null; + this._keyAddress = null; + this._program = null; + this._nestedHash = null; + this._nestedAddress = null; + this._scriptHash160 = null; + this._scriptHash256 = null; + this._scriptAddress = null; +}; + /** * Inject data from private key. * @private @@ -724,8 +739,8 @@ KeyRing.prototype.verify = function verify(msg, sig) { }; /** - * Get script type. - * @returns {ScriptType} + * Get witness program version. + * @returns {Number} */ KeyRing.prototype.getVersion = function getVersion() {