Skip to content

Commit 3198604

Browse files
committed
Merge pull request #3712
a3138ed add test of DecodeBase58 skipping whitespace (Christian von Roques)
2 parents a16ad1c + a3138ed commit 3198604

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/base58_tests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
6363
}
6464

6565
BOOST_CHECK(!DecodeBase58("invalid", result));
66+
67+
// check that DecodeBase58 skips whitespace, but still fails with unexpected non-whitespace at the end.
68+
BOOST_CHECK(!DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t a", result));
69+
BOOST_CHECK( DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t ", result));
70+
std::vector<unsigned char> expected = ParseHex("971a55");
71+
BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end());
6672
}
6773

6874
// Visitor to check address type

0 commit comments

Comments
 (0)