Forum Home
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    [Dev] Documenting Feathercoin Specific Software settings - Part 17

    Technical Development
    1
    50
    8344
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wrapper
      wrapper Moderators last edited by

      Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

      Initial work on tests allowing the test app to build. :: commit

      Work on tests allowing the test app to build.

      Correct issues with unit tests due to interface and new code variables etc.

      https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

      src/test/data/tx_valid.json

       -["The following is 23b397edccd3740a74adb603c9756370fafcde9bcc4483eb271ecad09a94dd63"],
       -["It is of particular interest because it contains an invalidly  -encoded signature which OpenSSL accepts"],
       -["See http://r6.ca/blog/20111119T211504Z.html"],
       -["It is also the first OP_CHECKMULTISIG transaction in standard form"],
       -[[["60a20bd93aa49ab4b28d514ec10b06e1829ce6818ec06cd3aabd013ebcdc4bb1", 0, "1 0x41 0x04cc71eb30d653c0c3163990c47b976f3fb3f37cccdcbedb169a1dfef58bbfbfaff7d8a473e7e2e6d317b87bafe8bde97e3cf8f065dec022b51d11fcdd0d348ac4 0x41 0x0461cbdcc5409fb4b4d42b51d33381354d80e550078cb532a34bfa2fcfdeb7d76519aecc62770f5b0e4ef8551946d8a540911abe3e7854a26f39f58b25c15342af 2 OP_CHECKMULTISIG"]],
       -"0100000001b14bdcbc3e01bdaad36cc08e81e69c82e1060bc14e518db2b49aa43ad90ba26000000000490047304402203f16c6f40162ab686621ef3000b04e75418a0c0cb2d8aebeac894ae360ac1e780220ddc15ecdfc3507ac48e1681a33eb60996631bf6bf5bc0a0682c4db743ce7ca2b01ffffffff0140420f00000000001976a914660d4ef3a743e3e696ad990364e555c271ad504b88ac00000000", true],
       -
       -["The following is a tweaked form of 23b397edccd3740a74adb603c9756370fafcde9bcc4483eb271ecad09a94dd63"],
       -["It has an arbitrary extra byte stuffed into the signature at pos length - 2"],
       -[[["60a20bd93aa49ab4b28d514ec10b06e1829ce6818ec06cd3aabd013ebcdc4bb1", 0, "1 0x41 0x04cc71eb30d653c0c3163990c47b976f3fb3f37cccdcbedb169a1dfef58bbfbfaff7d8a473e7e2e6d317b87bafe8bde97e3cf8f065dec022b51d11fcdd0d348ac4 0x41 0x0461cbdcc5409fb4b4d42b51d33381354d80e550078cb532a34bfa2fcfdeb7d76519aecc62770f5b0e4ef8551946d8a540911abe3e7854a26f39f58b25c15342af 2 OP_CHECKMULTISIG"]],
       -"0100000001b14bdcbc3e01bdaad36cc08e81e69c82e1060bc14e518db2b49aa43ad90ba260000000004A0048304402203f16c6f40162ab686621ef3000b04e75418a0c0cb2d8aebeac894ae360ac1e780220ddc15ecdfc3507ac48e1681a33eb60996631bf6bf5bc0a0682c4db743ce7ca2bab01ffffffff0140420f00000000001976a914660d4ef3a743e3e696ad990364e555c271ad504b88ac00000000", true],
       -
      

      Example of Bitcoin specific Code removed

       -["Tests for CheckTransaction()"],
      
      +["Tests for CTransaction::CheckTransaction()"],
      

      Code replaced

       + "01000000020001000000000000000000000000000000000000000000000000000000000000000000004948304502203a0f5f0e1f2bdbcd04db3061d18f3af70e07f4f467cbc1b8116f267025f5360b022100c792b6e215afc5afc721a351ec413e714305cb749aae3d7fee76621313418df101010000000002000000000000000000000000000000000000000000000000000000000000000000004847304402205f7530653eea9b38699e476320ab135b74771e1c48b81a5d041e2ca84b9be7a802200ac8d1f40fb026674fe5a5edd3dea715c27baa9baca51ed45ea750ac9dc0a55e81ffffffff010100000000000000015100000000", true]
      

      Code replaced

      1 Reply Last reply Reply Quote 0
      • wrapper
        wrapper Moderators last edited by

        Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

        Initial work on tests allowing the test app to build. :: commit

        Work on tests allowing the test app to build.

        Correct issues with unit tests due to interface and new code variables etc.

        https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

        src/test/key_tests.cpp

         -static const string strSecret1     ("5HxWvvfubhXpYYpS3tJkw6fq9jE9j18THftkZjHHfmFiWtmAbrj");
         +static const string strSecret1     ("5mDrMmqC7Rg32vN5REY55krG8L5sYtvjouhQFT2fJSWf6YNoAQF");
        
         -static const string strSecret2     ("5KC4ejrDjv152FGwP386VD1i2NYc5KkfSMyv1nGy1VGDxGHqVY3");
         +static const string strSecret2     ("5nEw8kna8rJtg3geRwVBZc1eErJDzdHSabLT1F4yrVUdmYhPHC1");
        
         -static const string strSecret1C    ("Kwr371tjA9u2rFSMZjTNun2PXXP3WPZu2afRHTcta6KxEUdm1vEw");
         +static const string strSecret1C    ("N2Birgsi3MuHyUY2Vxk91zYRmMEW7nCBx3bKcmtL3ybu95ZRtUa5");
        
         -static const string strSecret2C    ("L3Hq7a8FEQwJkW1M2GNKDW28546Vp5miewcCzSqUD9kCAXrJdS3g");
         +static const string strSecret2C    ("N6gVwEG9Fedy5LqzD5VPcuXqN8b2MM9ZuGYqn56ZwSgyHPTHUrLB");
        
         -static const CBitcoinAddress addr1 ("1QFqqMUD55ZV3PJEJZtaKCsQmjLT6JkjvJ");
         +static const CBitcoinAddress addr1 ("6mBjfXRA89XeSjTc1rzDQ1cWmggBvJ59NB");
        
         -static const CBitcoinAddress addr2 ("1F5y5E5FMc5YzdJtB9hLaUe43GDxEKXENJ");
         +static const CBitcoinAddress addr2 ("6jZqmkFVLY9LBgawnLqXUN5uj1NEHT3vc3");
        
         -static const CBitcoinAddress addr1C("1NoJrossxPBKfCHuJXT4HadJrXRE9Fxiqs");
         +static const CBitcoinAddress addr1C("71N4eaVLuWaqkQmBh64Pj9FtrHTRyauYwy");
        
        -static const CBitcoinAddress addr2C("1CRj2HyM1CXWzHAXLQtiGLyggNT9WQqsDs");
         +static const CBitcoinAddress addr2C("6jBJB4kS8tWVCV85e5EfeV8UEB6rAEXRfX");
        
         -static const string strAddressBad("1HV9Lc3sNHZxwj4Zk6fB38tEmBryq2cBiF");
         +static const string strAddressBad("6j67A8CE6DMgKMY4q3fgjC4UQoNzrNUdXX");
        

        Code replaced

         -    CKey key1  = bsecret1.GetKey();
        
         +    bool fCompressed;
         +    
         +    CSecret secret1 = bsecret1.GetSecret(fCompressed);
         +    CKey key1;
         +    key1.SetSecret(secret1);
         BOOST_CHECK(key1.IsCompressed() == false);
        
         -    CKey key2  = bsecret2.GetKey();
        
         +    
         +    CSecret secret2 = bsecret2.GetSecret(fCompressed);
         +    CKey key2;
         +    key2.SetSecret(secret2);
        
             BOOST_CHECK(key2.IsCompressed() == false);
        
         -    CKey key1C = bsecret1C.GetKey();
         +    
        
         -    BOOST_CHECK(key1C.IsCompressed() == true);
         +    
        
         -    CKey key2C = bsecret2C.GetKey();
        
         +    CSecret secret1C = bsecret1C.GetSecret(fCompressed);
         +    CKey key1C;
         +    key1C.SetSecret(secret1C);
         BOOST_CHECK(key1C.IsCompressed() == true);
         BOOST_CHECK(key1C.IsCompressed() == true);
         +    
         +    CSecret secret2C = bsecret2C.GetSecret(fCompressed);
         +    CKey key2C;
         +    key2C.SetSecret(secret2C);
         +    BOOST_CHECK(key2C.IsCompressed() == true);
        

        Code replaced

         -        BOOST_CHECK( pubkey1.Verify(hashMsg, sign1));
         +        BOOST_CHECK( key1.Verify(hashMsg, sign1));
        
         -        BOOST_CHECK(!pubkey1.Verify(hashMsg, sign2));
         +        BOOST_CHECK(!key1.Verify(hashMsg, sign2));
        
         -        BOOST_CHECK( pubkey1.Verify(hashMsg, sign1C));
         +        BOOST_CHECK( key1.Verify(hashMsg, sign1C));
        
         -        BOOST_CHECK(!pubkey1.Verify(hashMsg, sign2C));
         +        BOOST_CHECK(!key1.Verify(hashMsg, sign2C));
        
         -        BOOST_CHECK(!pubkey2.Verify(hashMsg, sign1));
         +        BOOST_CHECK(!key2.Verify(hashMsg, sign1));
        
         -        BOOST_CHECK( pubkey2.Verify(hashMsg, sign2));
         +        BOOST_CHECK( key2.Verify(hashMsg, sign2));
        
         -        BOOST_CHECK(!pubkey2.Verify(hashMsg, sign1C));
         +        BOOST_CHECK(!key2.Verify(hashMsg, sign1C));
        
         -        BOOST_CHECK( pubkey2.Verify(hashMsg, sign2C));
         +        BOOST_CHECK( key2.Verify(hashMsg, sign2C));
        
         -        BOOST_CHECK( pubkey1C.Verify(hashMsg, sign1));
         +        BOOST_CHECK( key1C.Verify(hashMsg, sign1));
        
         -        BOOST_CHECK(!pubkey1C.Verify(hashMsg, sign2));
         +        BOOST_CHECK(!key1C.Verify(hashMsg, sign2));
        
         -        BOOST_CHECK( pubkey1C.Verify(hashMsg, sign1C));
         +        BOOST_CHECK( key1C.Verify(hashMsg, sign1C));
        
         -        BOOST_CHECK(!pubkey1C.Verify(hashMsg, sign2C));
         +        BOOST_CHECK(!key1C.Verify(hashMsg, sign2C));
        
         -        BOOST_CHECK(!pubkey2C.Verify(hashMsg, sign1));
         +        BOOST_CHECK(!key2C.Verify(hashMsg, sign1));
        
         -        BOOST_CHECK( pubkey2C.Verify(hashMsg, sign2));
         +        BOOST_CHECK( key2C.Verify(hashMsg, sign2));
        
         -        BOOST_CHECK(!pubkey2C.Verify(hashMsg, sign1C));
         +        BOOST_CHECK(!key2C.Verify(hashMsg, sign1C));
        
         -        BOOST_CHECK( pubkey2C.Verify(hashMsg, sign2C));
         +        BOOST_CHECK( key2C.Verify(hashMsg, sign2C));
        

        Code replaced

         -        CPubKey rkey1, rkey2, rkey1C, rkey2C;
         +        CKey rkey1, rkey2, rkey1C, rkey2C;
        
        
         -        BOOST_CHECK(rkey1.RecoverCompact (hashMsg, csign1));
         +        BOOST_CHECK(rkey1.SetCompactSignature (hashMsg, csign1));
        
         -        BOOST_CHECK(rkey2.RecoverCompact (hashMsg, csign2));
         +        BOOST_CHECK(rkey2.SetCompactSignature (hashMsg, csign2));
        
         -        BOOST_CHECK(rkey1C.RecoverCompact(hashMsg, csign1C));
         +        BOOST_CHECK(rkey1C.SetCompactSignature(hashMsg, csign1C));
        
         -        BOOST_CHECK(rkey2C.RecoverCompact(hashMsg, csign2C));
         +        BOOST_CHECK(rkey2C.SetCompactSignature(hashMsg, csign2C));
        
         -        BOOST_CHECK(rkey1  == pubkey1);
         +        BOOST_CHECK(rkey1.IsCompressed() == pubkey1.IsCompressed());
        
         -        BOOST_CHECK(rkey2  == pubkey2);
         +        BOOST_CHECK(rkey2.IsCompressed()  == pubkey2.IsCompressed());
        
         -        BOOST_CHECK(rkey1C == pubkey1C);
         +        BOOST_CHECK(rkey1C.IsCompressed() == pubkey1C.IsCompressed());
        
         -        BOOST_CHECK(rkey2C == pubkey2C);
         +        BOOST_CHECK(rkey2C.IsCompressed() == pubkey2C.IsCompressed());
        

        Code replaced

        1 Reply Last reply Reply Quote 0
        • wrapper
          wrapper Moderators last edited by

          Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

          Initial work on tests allowing the test app to build. :: commit

          Work on tests allowing the test app to build.

          Correct issues with unit tests due to interface and new code variables etc.

          https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

          src/test/main_tests.cpp

           -        BOOST_CHECK(nSubsidy <= 50 * COIN);
          
           +        BOOST_CHECK(nSubsidy <= 200 * COIN);
          

          Code replaced

          1 Reply Last reply Reply Quote 0
          • wrapper
            wrapper Moderators last edited by

            Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

            Initial work on tests allowing the test app to build. :: commit

            Work on tests allowing the test app to build.

            Correct issues with unit tests due to interface and new code variables etc.

            https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

            src/test/miner_tests.cpp

            File removed

             -// Copyright (c) 2011     -2014 The Bitcoin Core developers
             -// Distributed under the MIT/X11 software license, see the accompanying
             -// file COPYING or http://www.opensource.org/licenses/mit -license.php.
             -
             -#include "main.h"
             -#include "miner.h"
             -#include "uint256.h"
             -#include "util.h"
             -
             -#include <boost/test/unit_test.hpp>
             -
             -extern void SHA256Transform(void* pstate, void* pinput, const void* pinit);
             -
             -BOOST_AUTO_TEST_SUITE(miner_tests)
            

            Example code removed

            1 Reply Last reply Reply Quote 0
            • wrapper
              wrapper Moderators last edited by

              Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

              Initial work on tests allowing the test app to build. :: commit

              Work on tests allowing the test app to build.

              Correct issues with unit tests due to interface and new code variables etc.

              https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

              src/test/multisig_tests.cpp

               -    BOOST_FOREACH(const CKey &key, keys)
              
               +    BOOST_FOREACH(CKey &key, keys)
              

              Code replaced

              1 Reply Last reply Reply Quote 0
              • wrapper
                wrapper Moderators last edited by

                Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                Initial work on tests allowing the test app to build. :: commit

                Work on tests allowing the test app to build.

                Correct issues with unit tests due to interface and new code variables etc.

                https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                src/test/rpc_tests.cpp

                  -BOOST_AUTO_TEST_CASE(rpc_rawsign)
                
                 +/*BOOST_AUTO_TEST_CASE(rpc_rawsign)
                
                 +}*/
                

                code commented out

                1 Reply Last reply Reply Quote 0
                • wrapper
                  wrapper Moderators last edited by

                  Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                  Initial work on tests allowing the test app to build. :: commit

                  Work on tests allowing the test app to build.

                  Correct issues with unit tests due to interface and new code variables etc.

                  https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                  src/test/rpc_tests.cpp

                  - LOCK(pwalletMain->cs_wallet);
                  
                  + LOCK2(cs_main, pwalletMain->cs_wallet);
                  

                  Code replaced

                  1 Reply Last reply Reply Quote 0
                  • wrapper
                    wrapper Moderators last edited by

                    Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                    Initial work on tests allowing the test app to build. :: commit

                    Work on tests allowing the test app to build.

                    Correct issues with unit tests due to interface and new code variables etc.

                    https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                    src/test/script_P2SH_tests.cpp

                    +    LOCK(cs_main);
                    

                    Code added

                     +    LOCK(cs_main);
                    

                    Code added
                    - keys.push_back(key[i].GetPubKey());
                    + keys.push_back(key[i]);
                    }

                     CScript inner[4];
                     inner[0].SetDestination(key[0].GetPubKey().GetID());
                    
                     -    inner[1].SetMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+2));
                     +    inner[1].SetMultisig(2, std::vector<CKey>(keys.begin(), keys.begin()+2));
                    
                     -    inner[2].SetMultisig(1, std::vector<CPubKey>(keys.begin(), keys.begin()+2));
                     +    inner[2].SetMultisig(1, std::vector<CKey>(keys.begin(), keys.begin()+2));
                    
                     -    inner[3].SetMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+3));
                     +    inner[3].SetMultisig(2, std::vector<CKey>(keys.begin(), keys.begin()+3));
                    

                    Code replaced

                    -    vector<CPubKey> keys;
                    
                    +    vector<CKey> keys;
                    

                    Code replaced

                     -        keys.push_back(key[i].GetPubKey());
                    
                     +        keys.push_back(key[i]);
                    

                    Code replaced

                    1 Reply Last reply Reply Quote 0
                    • wrapper
                      wrapper Moderators last edited by

                      Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                      Initial work on tests allowing the test app to build. :: commit

                      Work on tests allowing the test app to build.

                      Correct issues with unit tests due to interface and new code variables etc.

                      https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                      src/test/script_tests.cpp

                       +        int flagsNow = flags;
                       +        if (test.size() > 3 && ("," + test[2].get_str() + ",").find(",DERSIG,") != string::npos) {
                       +            flagsNow |= SCRIPT_VERIFY_DERSIG;
                       +        }
                       +
                      

                      Code added

                       -        BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, tx, 0, flags, SIGHASH_NONE), strTest);
                      
                       +        BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, tx, 0, flagsNow, SIGHASH_NONE), strTest);
                      

                      Code replaced

                       +        int flagsNow = flags;
                       +        if (test.size() > 3 && (","      + test[2].get_str()      + ",").find(",DERSIG,") != string::npos) {
                       +            flagsNow |= SCRIPT_VERIFY_DERSIG;
                       +        }
                       +
                           CTransaction tx;
                      
                       -        BOOST_CHECK_MESSAGE(!VerifyScript(scriptSig, scriptPubKey, tx, 0, flags, SIGHASH_NONE), strTest);
                       +        BOOST_CHECK_MESSAGE(!VerifyScript(scriptSig, scriptPubKey, tx, 0, flagsNow, SIGHASH_NONE), strTest);
                      
                      
                      
                       @@      -209,7      +219,7 @@ sign_multisig(CScript scriptPubKey, std::vector<CKey> keys, CTransaction transac
                       // and vice     -versa)
                       //
                      
                       result << OP_0;
                       -    BOOST_FOREACH(const CKey &key, keys)
                       +    BOOST_FOREACH(CKey &key, keys)
                      
                       {
                      
                           vector<unsigned char> vchSig;
                           BOOST_CHECK(key.Sign(hash, vchSig));
                        @@      -390,7      +400,7 @@ BOOST_AUTO_TEST_CASE(script_combineSigs)
                       BOOST_CHECK(combined == scriptSig);
                      
                      
                        // Hardest case:  Multisig 2 -of -3
                       -    scriptPubKey.SetMultisig(2, pubkeys);
                       +    scriptPubKey.SetMultisig(2, keys);
                      

                      Code replaced

                      1 Reply Last reply Reply Quote 0
                      • wrapper
                        wrapper Moderators last edited by

                        Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                        Initial work on tests allowing the test app to build. :: commit

                        Work on tests allowing the test app to build.

                        Correct issues with unit tests due to interface and new code variables etc.

                        https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                        src/test/scriptnum_tests.cpp

                        New file

                         +// Copyright (c) 2012-2014 The Bitcoin Core developers
                         +// Distributed under the MIT/X11 software license, see the accompanying
                         +// file COPYING or http://www.opensource.org/licenses/mit-license.php.
                         +
                         +#include "bignum.h"
                         +#include "script.h"
                         +#include <boost/test/unit_test.hpp>
                         +#include <limits.h>
                         +#include <stdint.h>
                         +BOOST_AUTO_TEST_SUITE(scriptnum_tests)
                         +
                         +static const int64_t values[] = \
                         +{ 0, 1, CHAR_MIN, CHAR_MAX, UCHAR_MAX, SHRT_MIN, USHRT_MAX, INT_MIN, INT_MAX, UINT_MAX, LONG_MIN, LONG_MAX };
                         +static const int64_t offsets[] = { 1, 0x79, 0x80, 0x81, 0xFF, 0x7FFF, 0x8000, 0xFFFF, 0x10000};
                         +
                         +static bool verify(const CBigNum& bignum, const CScriptNum& scriptnum)
                         +{
                         +    return bignum.getvch() == scriptnum.getvch() && bignum.getint() == scriptnum.getint();
                         +}
                         +
                         +static void CheckCreateVch(const int64_t& num)
                         +{
                         +    CBigNum bignum(num);
                         +    CScriptNum scriptnum(num);
                         +    BOOST_CHECK(verify(bignum, scriptnum));
                         +
                         +    CBigNum bignum2(bignum.getvch());
                         +    CScriptNum scriptnum2(scriptnum.getvch());
                         +    BOOST_CHECK(verify(bignum2, scriptnum2));
                         +
                         +    CBigNum bignum3(scriptnum2.getvch());
                         +    CScriptNum scriptnum3(bignum2.getvch());
                         +    BOOST_CHECK(verify(bignum3, scriptnum3));
                         +}
                         +
                         +static void CheckCreateInt(const int64_t& num)
                         +{
                         +    CBigNum bignum(num);
                         +    CScriptNum scriptnum(num);
                         +    BOOST_CHECK(verify(bignum, scriptnum));
                         +    BOOST_CHECK(verify(bignum.getint(), CScriptNum(scriptnum.getint())));
                         +    BOOST_CHECK(verify(scriptnum.getint(), CScriptNum(bignum.getint())));
                         +    BOOST_CHECK(verify(CBigNum(scriptnum.getint()).getint(), CScriptNum(CScriptNum(bignum.getint()).getint())));
                         +}
                         +
                         +
                         +static void CheckAdd(const int64_t& num1, const int64_t& num2)
                         +{
                         +    const CBigNum bignum1(num1);
                         +    const CBigNum bignum2(num2);
                         +    const CScriptNum scriptnum1(num1);
                         +    const CScriptNum scriptnum2(num2);
                         +    CBigNum bignum3(num1);
                         +    CBigNum bignum4(num1);
                         +    CScriptNum scriptnum3(num1);
                         +    CScriptNum scriptnum4(num1);
                         +
                         +    // int64_t overflow is undefined.
                         +    bool invalid = (((num2 > 0) && (num1 > (std::numeric_limits<int64_t>::max() - num2))) ||
                         +                    ((num2 < 0) && (num1 < (std::numeric_limits<int64_t>::min() - num2))));
                         +    if (!invalid)
                         +    {
                         +        BOOST_CHECK(verify(bignum1 + bignum2, scriptnum1 + scriptnum2));
                         +        BOOST_CHECK(verify(bignum1 + bignum2, scriptnum1 + num2));
                         +        BOOST_CHECK(verify(bignum1 + bignum2, scriptnum2 + num1));
                         +    }
                         +}
                         +
                         +static void CheckNegate(const int64_t& num)
                         +{
                         +    const CBigNum bignum(num);
                         +    const CScriptNum scriptnum(num);
                         +
                         +    // -INT64_MIN is undefined
                         +    if (num != std::numeric_limits<int64_t>::min())
                         +        BOOST_CHECK(verify(-bignum, -scriptnum));
                         +}
                         +
                         +static void CheckSubtract(const int64_t& num1, const int64_t& num2)
                         +{
                         +    const CBigNum bignum1(num1);
                         +    const CBigNum bignum2(num2);
                         +    const CScriptNum scriptnum1(num1);
                         +    const CScriptNum scriptnum2(num2);
                         +    bool invalid = false;
                         +
                         +    // int64_t overflow is undefined.
                         +    invalid = ((num2 > 0 && num1 < std::numeric_limits<int64_t>::min() + num2) ||
                         +               (num2 < 0 && num1 > std::numeric_limits<int64_t>::max() + num2));
                         +    if (!invalid)
                         +    {
                         +        BOOST_CHECK(verify(bignum1 - bignum2, scriptnum1 - scriptnum2));
                         +        BOOST_CHECK(verify(bignum1 - bignum2, scriptnum1 - num2));
                         +    }
                         +
                         +    invalid = ((num1 > 0 && num2 < std::numeric_limits<int64_t>::min() + num1) ||
                         +               (num1 < 0 && num2 > std::numeric_limits<int64_t>::max() + num1));
                         +    if (!invalid)
                         +    {
                         +        BOOST_CHECK(verify(bignum2 - bignum1, scriptnum2 - scriptnum1));
                         +        BOOST_CHECK(verify(bignum2 - bignum1, scriptnum2 - num1));
                         +    }
                         +}
                         +
                         +static void CheckCompare(const int64_t& num1, const int64_t& num2)
                         +{
                         +    const CBigNum bignum1(num1);
                         +    const CBigNum bignum2(num2);
                         +    const CScriptNum scriptnum1(num1);
                         +    const CScriptNum scriptnum2(num2);
                         +
                         +    BOOST_CHECK((bignum1 == bignum1) == (scriptnum1 == scriptnum1));
                         +    BOOST_CHECK((bignum1 != bignum1) ==  (scriptnum1 != scriptnum1));
                         +    BOOST_CHECK((bignum1 < bignum1) ==  (scriptnum1 < scriptnum1));
                         +    BOOST_CHECK((bignum1 > bignum1) ==  (scriptnum1 > scriptnum1));
                         +    BOOST_CHECK((bignum1 >= bignum1) ==  (scriptnum1 >= scriptnum1));
                         +    BOOST_CHECK((bignum1 <= bignum1) ==  (scriptnum1 <= scriptnum1));
                         +
                         +    BOOST_CHECK((bignum1 == bignum1) == (scriptnum1 == num1));
                         +    BOOST_CHECK((bignum1 != bignum1) ==  (scriptnum1 != num1));
                         +    BOOST_CHECK((bignum1 < bignum1) ==  (scriptnum1 < num1));
                         +    BOOST_CHECK((bignum1 > bignum1) ==  (scriptnum1 > num1));
                         +    BOOST_CHECK((bignum1 >= bignum1) ==  (scriptnum1 >= num1));
                         +    BOOST_CHECK((bignum1 <= bignum1) ==  (scriptnum1 <= num1));
                         +
                         +    BOOST_CHECK((bignum1 == bignum2) ==  (scriptnum1 == scriptnum2));
                         +    BOOST_CHECK((bignum1 != bignum2) ==  (scriptnum1 != scriptnum2));
                         +    BOOST_CHECK((bignum1 < bignum2) ==  (scriptnum1 < scriptnum2));
                         +    BOOST_CHECK((bignum1 > bignum2) ==  (scriptnum1 > scriptnum2));
                         +    BOOST_CHECK((bignum1 >= bignum2) ==  (scriptnum1 >= scriptnum2));
                         +    BOOST_CHECK((bignum1 <= bignum2) ==  (scriptnum1 <= scriptnum2));
                         +
                         +    BOOST_CHECK((bignum1 == bignum2) ==  (scriptnum1 == num2));
                         +    BOOST_CHECK((bignum1 != bignum2) ==  (scriptnum1 != num2));
                         +    BOOST_CHECK((bignum1 < bignum2) ==  (scriptnum1 < num2));
                         +    BOOST_CHECK((bignum1 > bignum2) ==  (scriptnum1 > num2));
                         +    BOOST_CHECK((bignum1 >= bignum2) ==  (scriptnum1 >= num2));
                         +    BOOST_CHECK((bignum1 <= bignum2) ==  (scriptnum1 <= num2));
                         +}
                         +
                         +static void RunCreate(const int64_t& num)
                         +{
                         +    CheckCreateInt(num);
                         +    CScriptNum scriptnum(num);
                         +    if (scriptnum.getvch().size() <= CScriptNum::nMaxNumSize)
                         +        CheckCreateVch(num);
                         +    else
                         +    {
                         +        BOOST_CHECK_THROW (CheckCreateVch(num), scriptnum_error);
                         +    }
                         +}
                         +
                         +static void RunOperators(const int64_t& num1, const int64_t& num2)
                         +{
                         +    CheckAdd(num1, num2);
                         +    CheckSubtract(num1, num2);
                         +    CheckNegate(num1);
                         +    CheckCompare(num1, num2);
                         +}
                         +
                         +BOOST_AUTO_TEST_CASE(creation)
                         +{
                         +    for(size_t i = 0; i < sizeof(values) / sizeof(values[0]); ++i)
                         +    {
                         +        for(size_t j = 0; j < sizeof(offsets) / sizeof(offsets[0]); ++j)
                         +        {
                         +            RunCreate(values[i]);
                         +            RunCreate(values[i] + offsets[j]);
                         +            RunCreate(values[i] - offsets[j]);
                         +        }
                         +    }
                         +}
                         +
                         +BOOST_AUTO_TEST_CASE(operators)
                         +{
                         +    for(size_t i = 0; i < sizeof(values) / sizeof(values[0]); ++i)
                         +    {
                         +        for(size_t j = 0; j < sizeof(offsets) / sizeof(offsets[0]); ++j)
                         +        {
                         +            RunOperators(values[i], values[i]);
                         +            RunOperators(values[i], -values[i]);
                         +            RunOperators(values[i], values[j]);
                         +            RunOperators(values[i], -values[j]);
                         +            RunOperators(values[i] + values[j], values[j]);
                         +            RunOperators(values[i] + values[j], -values[j]);
                         +            RunOperators(values[i] - values[j], values[j]);
                         +            RunOperators(values[i] - values[j], -values[j]);
                         +            RunOperators(values[i] + values[j], values[i] + values[j]);
                         +            RunOperators(values[i] + values[j], values[i] - values[j]);
                         +            RunOperators(values[i] - values[j], values[i] + values[j]);
                         +            RunOperators(values[i] - values[j], values[i] - values[j]);
                         +        }
                         +    }
                         +}
                         +
                         +BOOST_AUTO_TEST_SUITE_END()
                        

                        Code added

                        1 Reply Last reply Reply Quote 0
                        • wrapper
                          wrapper Moderators last edited by

                          Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                          Initial work on tests allowing the test app to build. :: commit

                          Work on tests allowing the test app to build.

                          Correct issues with unit tests due to interface and new code variables etc.

                          https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                          src/test/sigopcount_tests.cpp

                          -    std::vector<CPubKey> keys;
                          
                          +    std::vector<CKey> keys;
                          

                          Code replaced

                           -        keys.push_back(k.GetPubKey());
                          
                           +        keys.push_back(k);
                          

                          Code replaced

                          1 Reply Last reply Reply Quote 0
                          • wrapper
                            wrapper Moderators last edited by

                            Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                            Initial work on tests allowing the test app to build. :: commit

                            Work on tests allowing the test app to build.

                            Correct issues with unit tests due to interface and new code variables etc.

                            https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                            src/test/transaction_tests.cpp

                             +    LOCK(cs_main);
                            

                            Code added

                            1 Reply Last reply Reply Quote 0
                            • wrapper
                              wrapper Moderators last edited by

                              Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                              Initial work on tests allowing the test app to build. :: commit

                              Work on tests allowing the test app to build.

                              Correct issues with unit tests due to interface and new code variables etc.

                              https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                              src/test/util_tests.cpp

                               -/*These are platform-dependant and thus removed to avoid useless test failures
                              
                               -    // Formats used within Bitcoin
                              

                              Code / comments removed

                               +    BOOST_CHECK_EQUAL(DateTimeStrFormat("%a, %d %b %Y %H:%M:%S +0000", 1317425777), "Fri, 30 Sep 2011 23:36:17 +0000");
                              

                              Code added

                               -    BOOST_CHECK(strprintf("%s %d %s", B, s64t, E) == B" -9223372036854775807 "E);
                               +    BOOST_CHECK(strprintf("%s %d %s", B, s64t, E) == B" -9223372036854775807 " E);
                              
                               -    BOOST_CHECK(strprintf("%s %u %s", B, u64t, E) == B" 18446744073709551615 "E);
                               +    BOOST_CHECK(strprintf("%s %u %s", B, u64t, E) == B" 18446744073709551615 " E);
                              
                               -    BOOST_CHECK(strprintf("%s %x %s", B, u64t, E) == B" ffffffffffffffff "E);
                               +    BOOST_CHECK(strprintf("%s %x %s", B, u64t, E) == B" ffffffffffffffff " E);
                              
                              
                               size_t st = 12345678; /* unsigned size_t test value */
                               ssize_t sst = -12345678; /* signed size_t test value */
                              
                               -    BOOST_CHECK(strprintf("%s %"PRIszd" %s", B, sst, E) == B" -12345678 "E);
                               +    BOOST_CHECK(strprintf("%s %d %s", B, sst, E) == B" -12345678 " E);
                               -    BOOST_CHECK(strprintf("%s %"PRIszu" %s", B, st, E) == B" 12345678 "E);
                               +    BOOST_CHECK(strprintf("%s %u %s", B, st, E) == B" 12345678 " E);
                               -    BOOST_CHECK(strprintf("%s %"PRIszx" %s", B, st, E) == B" bc614e "E);
                               +    BOOST_CHECK(strprintf("%s %x %s", B, st, E) == B" bc614e " E);
                              
                              
                               ptrdiff_t pt = 87654321; /* positive ptrdiff_t test value */
                               ptrdiff_t spt = -87654321; /* negative ptrdiff_t test value */
                              
                               -    BOOST_CHECK(strprintf("%s %"PRIpdd" %s", B, spt, E) == B" -87654321 "E);
                               +    BOOST_CHECK(strprintf("%s %d %s", B, spt, E) == B" -87654321 " E);
                              
                               -    BOOST_CHECK(strprintf("%s %"PRIpdu" %s", B, pt, E) == B" 87654321 "E);
                               +    BOOST_CHECK(strprintf("%s %u %s", B, pt, E) == B" 87654321 " E);
                              
                               -    BOOST_CHECK(strprintf("%s %"PRIpdx" %s", B, pt, E) == B" 5397fb1 "E);
                               +    BOOST_CHECK(strprintf("%s %x %s", B, pt, E) == B" 5397fb1 " E);
                              

                              Code replaced

                              1 Reply Last reply Reply Quote 0
                              • wrapper
                                wrapper Moderators last edited by wrapper

                                Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                Initial work on tests allowing the test app to build. :: commit

                                Work on tests allowing the test app to build.

                                Correct issues with unit tests due to interface and new code variables etc.

                                https://github.com/FeatherCoin/Feathercoin/commit/dcbb5df357a8a079ef3e21f1508c7ac0231654dc

                                src/wallet.cpp

                                 +        printf("Stealth send to generated pubkey %" PRIszu ": %s\n", pkSendTo.size(), HexStr(pkSendTo).c_str());
                                
                                 +        printf("ephem_pubkey %" PRIszu ": %s\n", ephem_pubkey.size(), HexStr(ephem_pubkey).c_str());
                                
                                
                                 +                LogPrintf("pkExtracted=%" PRIszu ":%s\n", pkExtracted.size(), HexStr(pkExtracted).c_str());//为空
                                
                                 +                LogPrintf("pkExtracted= %" PRIszu ": %s\n", pkExtracted.size(), HexStr(pkExtracted).c_str());//pkOut
                                

                                Code replaced space / padding

                                1 Reply Last reply Reply Quote 0
                                • wrapper
                                  wrapper Moderators last edited by

                                  Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                  Update Unix build instructions to inclide openSSL build from scratch :: commit

                                  https://github.com/FeatherCoin/Feathercoin/commit/46366fc62cba1ddb37520c4d23c84c703b2408f6

                                  doc/README.md

                                   +
                                   +### Build Feathercoin using  openSSL  from source
                                   +
                                   +cd ~/Feathercoin/
                                   +mkdir openSSL
                                   +cd openSSL
                                   +wget https://www.openssl.org/source/openssl-1.0.1l.tar.gz
                                   +tar zxvf openssl-1.0.1l.tar.gz
                                   +cd openssl-1.0.1l
                                   +export CFLAGS="-fPIC"
                                   +./config --prefix=~/Feathercoin/openSSL/build shared enable-ec enable-ecdh enable-ecdsa -lanl -ldl
                                   +sudo make
                                   +sudo make install
                                   +
                                   +
                                   +**Build with custom openSSL builds**
                                   +
                                   +cd /Feathercoin
                                   +
                                   +make clean
                                   +
                                   +./autogen.sh
                                   +
                                   +./configure --prefix=/home/aciddude/Feathercoin/build CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" PKG_CONFIG_PATH=/home/aciddude/Feathercoin/openSSL/build/lib/pkgconfig LIBS=-Wl,-rpath=/home/aciddude/Feathercoin/openSSL/build/lib --disable-tests SSL_LIBS="/home/aciddude/Feathercoin/openSSL/build/lib/libssl.a /home/aciddude/Feathercoin/openSSL/build/lib/libcrypto.a -ldl" --with-gui
                                   +
                                   +time make
                                   +
                                   +sudo make install
                                   +
                                   +
                                  

                                  Code added

                                  1 Reply Last reply Reply Quote 0
                                  • wrapper
                                    wrapper Moderators last edited by

                                    Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                    Final fix for build tests :: commit

                                    Work on tests allowing the test app to build.

                                    Correct issues with unit tests due to interface and new code variables etc.

                                    https://github.com/FeatherCoin/Feathercoin/commit/2d17002e704eeeb05cbd14dc57e7b91482f31f3f

                                    src/test/base58_tests.cpp

                                     +            CSecret privkey(exp_payload.begin(), exp_payload.end());
                                                  CKey key;
                                    
                                     -            CSecret secret2;
                                    
                                     +            key.SetSecret(privkey, isCompressed);
                                    
                                     -            key.SetSecret(secret2); 
                                     -            secret.SetSecret(secret2, isCompressed);
                                     -            BOOST_CHECK_MESSAGE(secret.ToString() == exp_base58string, "result mismatch: " + strTest);
                                    
                                     +            bool fCompressed=false;
                                     +            secret.SetSecret(privkey, isCompressed);
                                     +            BOOST_CHECK_MESSAGE(secret.ToString().c_str() == exp_base58string, "result mismatch: " + strTest);
                                         }
                                         }
                                     +        
                                    

                                    Code replaced

                                    1 Reply Last reply Reply Quote 0
                                    • wrapper
                                      wrapper Moderators last edited by

                                      Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                      Final fix for build tests :: commit

                                      Work on tests allowing the test app to build.

                                      Correct issues with unit tests due to interface and new code variables etc.

                                      https://github.com/FeatherCoin/Feathercoin/commit/2d17002e704eeeb05cbd14dc57e7b91482f31f3f

                                      src/test/data/base58_keys_valid.json

                                        -        "5nYxd8Vcb5CwwSZzeYkLf2UHrHbet1QqDzbZDjx1h2kP6k9RJms", 
                                       +        "5njpn1dGnyhduB3Hog2tCoYcAS3XUg9F1saQAcKJbbpy2FszZcR", 
                                      
                                       -        "C862A03EE716826803C17C8A0F82B86D250FB63A5044A01F906F860878E26079", 
                                       +        "E10E0E8270779EE90D3577C1AD767645933DAE88AD7049FFF17D259865BD327E", 
                                      

                                      Code replaced

                                      1 Reply Last reply Reply Quote 0
                                      • wrapper
                                        wrapper Moderators last edited by

                                        Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                        Final fix for build tests :: commit

                                        Work on tests allowing the test app to build.

                                        Correct issues with unit tests due to interface and new code variables etc.

                                        https://github.com/FeatherCoin/Feathercoin/commit/2d17002e704eeeb05cbd14dc57e7b91482f31f3f

                                        src/test/key_tests.cpp

                                         -        "5nYxd8Vcb5CwwSZzeYkLf2UHrHbet1QqDzbZDjx1h2kP6k9RJms", 
                                         +        "5njpn1dGnyhduB3Hog2tCoYcAS3XUg9F1saQAcKJbbpy2FszZcR", 
                                        
                                         -         "C862A03EE716826803C17C8A0F82B86D250FB63A5044A01F906F860878E26079", 
                                         +        "E10E0E8270779EE90D3577C1AD767645933DAE88AD7049FFF17D259865BD327E", 
                                        

                                        Code replaced

                                        1 Reply Last reply Reply Quote 0
                                        • wrapper
                                          wrapper Moderators last edited by

                                          Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                          Final fix for build tests :: commit

                                          Work on tests allowing the test app to build.

                                          Correct issues with unit tests due to interface and new code variables etc.

                                          https://github.com/FeatherCoin/Feathercoin/commit/2d17002e704eeeb05cbd14dc57e7b91482f31f3f

                                          src/test/key_tests.cpp

                                           -    key1C.SetSecret(secret1C);
                                          
                                           +    key1C.SetSecret(secret1C, fCompressed);
                                          

                                          Code replaced

                                           -    key2C.SetSecret(secret2C);
                                          
                                           +    key2C.SetSecret(secret2C, fCompressed);
                                          

                                          Code replaced

                                          1 Reply Last reply Reply Quote 0
                                          • wrapper
                                            wrapper Moderators last edited by

                                            Feathercoin specific changes made to convert Bitcoin to FTC 0.9.6.*

                                            Final fix for build tests :: commit

                                            Work on tests allowing the test app to build.

                                            Correct issues with unit tests due to interface and new code variables etc.

                                            https://github.com/FeatherCoin/Feathercoin/commit/2d17002e704eeeb05cbd14dc57e7b91482f31f3f

                                            src/test/main_tests.cpp

                                              -    for (int nHeight = 0; nHeight < 14000000; nHeight += 1000) {
                                            
                                             +    for (int nHeight = 0; nHeight < 21000000; nHeight += 1000) {
                                            

                                            Code replaced

                                             -    BOOST_CHECK(nSum == 2099999997690000ULL);
                                            
                                             +    BOOST_CHECK_EQUAL(nSum, 33581578125000000ULL);
                                            

                                            Code replaced

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post