mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Simplify RipplePublicKey:
This implements the bare minimum necessary to store a 33 byte public key and use it in ordered containers. It is an efficient and well defined alternative to RippleAddress when the caller only needs a node public key.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <ripple/crypto/RFC1751.h>
|
||||
#include <ripple/protocol/RippleAddress.h>
|
||||
#include <ripple/protocol/Serializer.h>
|
||||
#include <ripple/types/RipplePublicKey.h>
|
||||
#include <beast/unit_test/suite.h>
|
||||
#include <openssl/ripemd.h>
|
||||
#include <openssl/bn.h>
|
||||
@@ -137,6 +138,13 @@ RippleAddress RippleAddress::createNodePublic (std::string const& strPublic)
|
||||
return naNew;
|
||||
}
|
||||
|
||||
RipplePublicKey
|
||||
RippleAddress::toPublicKey() const
|
||||
{
|
||||
assert (nVersion == VER_NODE_PUBLIC);
|
||||
return RipplePublicKey (vchData.begin(), vchData.end());
|
||||
}
|
||||
|
||||
NodeID RippleAddress::getNodeID () const
|
||||
{
|
||||
switch (nVersion)
|
||||
@@ -969,7 +977,7 @@ public:
|
||||
expect (deprecatedPublicKey.humanNodePublic () ==
|
||||
"n94a1u4jAz288pZLtw6yFWVbi89YamiC6JBXPVUj5zmExe5fTVg9",
|
||||
deprecatedPublicKey.humanNodePublic ());
|
||||
RipplePublicKey publicKey (deprecatedPublicKey);
|
||||
RipplePublicKey publicKey = deprecatedPublicKey.toPublicKey();
|
||||
expect (publicKey.to_string() == deprecatedPublicKey.humanNodePublic(),
|
||||
publicKey.to_string());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user