Post
Topic
Board Altcoin Discussion
Re: Is it true that Vanillacoin uses the BTC code?
by
Rick Storm
on 12/08/2015, 21:36:20 UTC
Comparing a sample piece of code it is clear that at least some of it is based on Bitcoin code:

From vanillacoin - https://github.com/john-connor/vanillacoin/blob/master/src/address_manager.cpp#L1315

Code:
     * Try to find an entry that can be erased.
     */
    for (auto it = bucket_new.begin(); it != bucket_new.end(); ++it)
    {
        assert(address_info_map_.count(*it));
       
        auto & info = address_info_map_[*it];
       
        if (info.is_terrible())
        {
            if (--info.reference_count == 0)
            {
                std::lock_guard l1(mutex_random_ids_);
               
                swap_random(
                    info.random_position,
                    static_cast (random_ids_.size() - 1)
                );
               
                random_ids_.pop_back();
                network_address_map_.erase(info.addr);
                address_info_map_.erase(*it);
                number_new_--;
            }
           
            bucket_new.erase(it);
           
            return;

From Bitcoin 0.9.2 in addrman.cpp:

Code:
    // first look for deletable items
    for (std::set::iterator it = vNew.begin(); it != vNew.end(); it++)
    {
        assert(mapInfo.count(*it));
        CAddrInfo &info = mapInfo[*it];
        if (info.IsTerrible())
        {
            if (--info.nRefCount == 0)
            {
                SwapRandom(info.nRandomPos, vRandom.size()-1);
                vRandom.pop_back();
                mapAddr.erase(info);
                mapInfo.erase(*it);
                nNew--;
            }
            vNew.erase(it);
            return 0;
        }
    }

The above code from vanillacoin is based on bitcoin, albeit renamed, refactored, reformatted and re-commented at almost every possible occasion.

The algorithm is the same line by line and even the esoteric identifier name "IsTerrible"/"is_terrible" is used in both.

My guess is John started with a old bitcoin code base and refactored, renamed and recommented the code to a huge degree.

There has also been additions like the zerotime stuff which is not like anything in Bitcoin:

https://github.com/john-connor/vanillacoin/blob/master/src/zerotime.cpp