linearize script: Option to use RPC cookie #10104

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:linearize-use-cookie changing 3 files +25 −2
  1. achow101 commented at 4:21 AM on March 28, 2017: member

    This PR adds the a datadir option to the linearize configuration file to allow linearize-hashes to look for and use the RPC cookie file in the datadir. It will still allow rpcuser and rpcpassword to be specified and those options will take precendence if both rpcuser/pass and datadir config options are set.

    closes #10103

  2. jonasschnelli commented at 7:21 AM on March 28, 2017: contributor

    Nice. utACK 476c6d4c8dcf41f9e3accf5be1b84fdd4718046b

  3. jonasschnelli added the label Scripts and tools on Mar 28, 2017
  4. laanwj commented at 7:33 AM on March 29, 2017: member

    Makes sense, utACK

  5. laanwj commented at 9:09 AM on March 29, 2017: member

    @pstratem can you confirm that this implements what you requested in #10103?

  6. MarcoFalke commented at 9:10 AM on March 29, 2017: member

    utACK 476c6d4

  7. in contrib/linearize/linearize-hashes.py:98 in 476c6d4c8d outdated
      92 | @@ -93,6 +93,14 @@ def get_block_hashes(settings, max_blocks_per_call=10000):
      93 |  
      94 |  		height += num_blocks
      95 |  
      96 | +def get_rpc_cookie(settings):
      97 | +	# Open the cookie file
      98 | +	with open(settings['datadir'] + '/.cookie', 'r') as f:
    


    pstratem commented at 6:08 PM on March 29, 2017:

    open(os.path.join(os.path.expanduser(settings['datadir']), '/.cookie'), 'r')


    achow101 commented at 6:55 PM on March 29, 2017:

    done

  8. pstratem changes_requested
  9. achow101 force-pushed on Mar 29, 2017
  10. pstratem commented at 11:47 PM on March 29, 2017: contributor

    @achow101 need to import os.path

  11. pstratem commented at 11:57 PM on March 29, 2017: contributor

    my bad

    diff --git a/contrib/linearize/linearize-hashes.py b/contrib/linearize/linearize-hashes.py
    index 721d204..db8eb70 100755
    --- a/contrib/linearize/linearize-hashes.py
    +++ b/contrib/linearize/linearize-hashes.py
    @@ -16,6 +16,8 @@ import json
     import re
     import base64
     import sys
    +import os
    +import os.path
     
     settings = {}
     
    @@ -93,9 +95,9 @@ def get_block_hashes(settings, max_blocks_per_call=10000):
     
                    height += num_blocks
     
    -def get_rpc_cookie(settings):
    +def get_rpc_cookie():
            # Open the cookie file
    -       with open(os.path.join(os.path.expanduser(settings['datadir']), '/.cookie'), 'r') as f:
    +       with open(os.path.join(os.path.expanduser(settings['datadir']), '.cookie'), 'r') as f:
                    combined = f.readline()
                    combined_split = combined.split(":")
                    settings['rpcuser'] = combined_split[0]
    @@ -150,6 +152,6 @@ if __name__ == '__main__':
     
            # Get the rpc user and pass from the cookie if the datadir is set
            if use_datadir:
    -               get_rpc_cookie(settings)
    +               get_rpc_cookie()
     
            get_block_hashes(settings)
    
  12. achow101 force-pushed on Mar 30, 2017
  13. Datadir option in linearize scripts
    Adds a datadir configuration option to the linearize scripts to allow the script to use the RPC cookie instead of requiring the user to set a rpcuser and rpcpassword for the rpc server.
    bd41d9831f
  14. achow101 force-pushed on Mar 30, 2017
  15. achow101 commented at 12:14 AM on March 30, 2017: member

    @pstratem Now is it right?

  16. laanwj merged this on Apr 5, 2017
  17. laanwj closed this on Apr 5, 2017

  18. laanwj referenced this in commit fadf078c9c on Apr 5, 2017
  19. achow101 deleted the branch on Apr 5, 2017
  20. PastaPastaPasta referenced this in commit ddf63f66fd on May 10, 2019
  21. PastaPastaPasta referenced this in commit 7093ba84ba on May 15, 2019
  22. PastaPastaPasta referenced this in commit 13cdff4989 on May 20, 2019
  23. PastaPastaPasta referenced this in commit 746d6e4469 on May 21, 2019
  24. barrystyle referenced this in commit 1cfab2c1ff on Jan 22, 2020
  25. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me