Transaction.prototype.Verify = function() { var account = Accounts.AddOrGetAccount(this.GetSenderId().toString()); if (account == null) { return false; } var data = curve.sha256(this.GetBytes()); console.log("Transaction data virify", data); var isSignVerified = Crypto.Verify(this.signature.toString("hex"), data.toString("hex"), this.senderPublicKey.toString("hex")); return isSignVerified && account.SetOrVerify(this.senderPublicKey, this.height); }
Transaction.prototype.Apply = function() { var senderAccount = Accounts.GetAccount(this.GetSenderId()); senderAccount.Apply(this.senderPublicKey, this.height); var recipientAccount = Accounts.GetAccount(this.recipientId); if (recipientAccount == null) { recipientAccount = Accounts.AddOrGetAccount(recipientId); } this.type.Apply(this, senderAccount, recipientAccount); /* for (Appendix.AbstractAppendix appendage : appendages) { appendage.apply(this, senderAccount, recipientAccount); } */ }