fix isEncrypted.

This commit is contained in:
Christopher Jeffrey 2014-10-29 12:56:39 -07:00
parent ed9508740a
commit 98465d61e8
2 changed files with 18 additions and 4 deletions

View File

@ -747,10 +747,18 @@ Wallet.prototype.encrypt = function(options) {
return bitcoindjs.walletEncrypt(options || {});
};
Wallet.prototype.isEncrypted = function() {
Wallet.prototype.encrypted = function() {
return bitcoindjs.walletEncrypted();
};
Wallet.prototype.isEncrypted = function() {
return this.encrypted().encrypted;
};
Wallet.prototype.isLocked = function() {
return this.encrypted().locked;
};
Wallet.prototype.dumpKey = function(options) {
return bitcoindjs.dumpKey(options || {});
};

View File

@ -3748,12 +3748,18 @@ NAN_METHOD(WalletEncrypted) {
"Usage: bitcoindjs.walletEncrypted()");
}
bool isLocked = pwalletMain->IsLocked();
bool isEncrypted = pwalletMain->IsCrypted();
bool isLocked = false;
bool isEncrypted = false;
isEncrypted = pwalletMain->IsCrypted();
if (isEncrypted) {
isLocked = pwalletMain->IsLocked();
}
Local<Object> result = NanNew<Object>();
result->Set(NanNew<String>("locked"), NanNew<Boolean>(isLocked));
result->Set(NanNew<String>("encrypted"), NanNew<Boolean>(isCrypted));
result->Set(NanNew<String>("encrypted"), NanNew<Boolean>(isEncrypted));
NanReturnValue(result);
}